51/52系列单片机片内有21/26个特殊功能寄存器。特殊功能寄存器(SFR,Special Function Register),又称专用寄存器,位于80H~FFH,但仅有21个字节(MCS-51系列)或26个字节(MCS-52子系列)作为SFR离散分布在这128个字节范围内,每个字节对应一个SFR。其余字节无定义,用户不能对这些单元进行读/写操作。26个SFR中,有12个的地址可被8整除,支持位寻址(bit-addressable)。
特殊功能寄存器反映了单片机的状态,是单片机的状态及控制字寄存器。可分为两类:
- 芯片内部功能的控制用寄存器:运算部件寄存器A、B、PSW、堆栈指针SP、数据指针DPTR、各种定时/计数器控制、中断控制、串行口控制等;
- 与芯片引脚有关的寄存器:P0、P1、P2、P3,它们实际上是4个锁存器,每个锁存器再附加上相应的一个输出驱动器和一个输入缓冲器就构成了一个并行口。
1 累加器ACC
Accumulator Register,应用最广泛的专用寄存器。许多单操作数指令的操作数、双操作数指令的一个操作数取自累加器。加、减、乘、除算术运算指令的结果都存放在累加器A或寄存器B中。累加器ACC的助记符是A,当对累加器的位进行操作时,常用符号是ACC,比如累加器D0位是“ACC.0”。
2 寄存器B
B Register,用于乘除运算或作为一般寄存器。
Ø 乘:两个操作数一个是累加器A,另一个必须是寄存器B,结果存在A和B中;
Ø 除:被除数是累加器A,除数是寄存器B,商存在A中,余数存在B中。
3 程序状态字PSW
Program State Word,存放着当前ALU的操作状态特征,其内部定义如下表。
4 堆栈及堆栈指针SP
Stack Pointer,堆栈的特点是“先进后出”,是为程序调用和中断操作而设立的,主要是保护断点和保护现场。单片机中,CPU无论是执行子程序调用操作还是执行中断操作,最终都要返回,因此需预先把主程序的被中断的地方(称为断点)保护起来,为正确返回做准备,实现保护现场的功能。为使CPU能进行多级中断嵌套及多重子程序调用,堆栈必须有足够容量。
堆栈指针SP,就是栈顶的存储单元地址。当堆栈无数据时,栈顶地址与栈底地址重合。51单片机的堆栈指针SP为8位寄存器,系统复位后,SP初值为07H,实际应用中通常根据需要在主程序开始处对堆栈指针SP进行初始化,一般在片内RAM的30H~7FH区域中开辟堆栈区,一般将SP设置为60H。
堆栈有向上生长型和向下生长型。MCS-51单片机的堆栈结构属于向上生长型,遵循“先加后压”规则:入栈时,先SP加1,然后数据写入栈;出栈时,先读出数据,再SP减1。
堆栈的使用方式有两种:
Ø 自动方式,在调用子程序或断点时,断点地址自动进入栈,程序返回时,断点地址再自动弹回PC,不需要用户干涉。
Ø 指令方式,使用专用的堆栈操作指令进行入、出栈操作。例如保护现场、恢复现场。需要保护的数据单元量由用户设定。
5 数据指针DPTR
Data Pointer,既可是一个16位专用寄存器(DPTR),有16位数加“1”功能;也可拆开作为两个8位寄存器(高位字节寄存器DPH、低位字节寄存器DPL)。DPTR是继程序计数器(PC)以外的第二个16位寄存器,主要用途是保存16位地址信息,常用于基址加变址间接寄存器寻址方式使用,寻址片外64KB的数据存储器或程序存储器空间。
7 端口寄存器P0~P3
专用寄存器P0~P3分别是I/O端口P0~P3的8位锁存器,均为可位寻址寄存器。
15 定时/计数器TL0~TH1
51单片机有两个16位定时/计数器T0和T1,52比51多一个16位定时/计数器T2。它们都是由两个独立的8位寄存器TH和TL组成的16位寄存器。
11 中断允许寄存器IE
Interrupt Enable Register,字节地址为A8H。每一位对应不同的中断源,可设定为“允许(1)”或“禁止(0)”中断。单片机复位后会被清0。欲使某中断源允许中断,设置IE对应位的同时还必须设置IE中的最高位EA,使EA=1(CPU开放中断)。EA相当于中断允许的“总开关”。
12 中断优先级寄存器IP
Interrupt Priority Register,字节地址为B8H。每一位对应不同的中断源,其复位清“0”会把对应中断源设置为低优先级中断;置“1”将把对应中断源设置为高优先级。例如要使T0中断的优先级高于外部中断请求0中断,可将PX0清“0”、PTO置“1”。单片机复位后会被清0。
13 定时器工作方式寄存器TMOD
Timer Mode,D0~D3管理T0,D4~D7管理T1。
14 定时器控制寄存器TCON
Timer Control Register,属于中断标志位寄存器。字节地址为88H,主要用来控制2个定时/计数器溢出中断标志及2个外部中断INT0和INT1请求标志。
19 串行口控制寄存器SCON
Serial Control Register,属于中断标志位寄存器。字节地址为98H。与中断相关是SCON的低2位,用来锁存串行口的发送(Transmit)中断和接收(Receive)中断标志。
20 串行数据寄存器SBUF
Serial Buffer,用于串行通信,存放发送和接收数据。逻辑上是一个寄存器,物理上是两个寄存器:发送缓冲寄存器、接收缓冲寄存器,使用同一个逻辑地址,写入时SBUF指向发送数据缓冲器、读入时SBUF取自接收缓冲寄存器。
串行口对外有两条独立的收、发信号线:RXD和TXD,可以同时发送和接收数据,实现全双工传送。例:
21 电源控制寄存器PCON
Power Control Register,电源控制及波特率选择寄存器,字节地址为87H。
内容来自互联网摘抄
侵删
Официальная покупка аттестата о среднем образовании в Москве и других городах
Meds information leaflet. Brand names.
pregabalin genericon
Some what you want to know about drugs. Read information here.
where can i get cheap cozaar without prescription
Drugs information for patients. Short-Term Effects.
where to get generic xenical pill
Everything about medicines. Get information here.
order generic furosemide without a prescription
villas with pool real estate Montenegro
villas with pools Montenegro property sales
Medicament prescribing information. Short-Term Effects.
where to buy cheap fexofenadine without insurance
Everything news about pills. Read information here.
properties for sale tivat real estate Montenegro
kotor real estate realty Montenegro
Drug information. Effects of Drug Abuse.
lyrica tablet
Actual news about meds. Read information now.
Приобретение диплома ПТУ с сокращенной программой обучения в Москве
Medication information. What side effects?
azithromycin dairy interaction
Some news about medicines. Read here.
long-term housing options realty Montenegro
can i buy tenormin no prescription
Medicines prescribing information. What side effects can this medication cause?
how to buy generic ramipril pill
Everything what you want to know about pills. Get here.
Medicine information sheet. Drug Class.
can i buy generic compazine without a prescription
Some trends of drugs. Read information here.
can i order cheap pregabalin pills
Medicines information leaflet. Long-Term Effects.
priligy rx
Best what you want to know about medicine. Read now.
Medicament prescribing information. Cautions.
can i get cheap keflex pill
Everything news about drugs. Read information now.
Medication information for patients. What side effects?
get cheap trileptal tablets
Some information about drugs. Get here.
where can i buy nizoral no prescription
Drugs information. Cautions.
comparing the effects of cymbalta and avanza which medication works best
Actual news about medicines. Read now.
Pills information leaflet. Generic Name.
where to buy cheap phenytoin tablets
Actual about drugs. Read here.
Medicines information. Effects of Drug Abuse.
can you get generic xenical without insurance
Best trends of pills. Read here.
Купить диплом магистра оказалось возможно, быстрое обучение и диплом на руки
Аттестат 11 класса купить официально с упрощенным обучением в Москве
Medicament information sheet. Brand names.
can you get generic zithromax for sale
Some about medication. Get information now.
Medication information. What side effects?
xenical medicine
Best about medication. Get information here.
prednisone for sae without prescription
стоимость укладки кафельной плитки за квадратный метр https://ukladka-keramogranita-spb.ru
Drug information leaflet. What side effects can this medication cause?
how to get generic inderal without a prescription
Best about medicine. Get now.
Всё, что нужно знать о покупке аттестата о среднем образовании без рисков
Drug information. Generic Name.
where can i get cheap finpecia for sale
Everything information about medicines. Get information here.
Drug information for patients. What side effects can this medication cause?
how can i get generic ursodiol without dr prescription
Everything about meds. Get here.
http://geniled.com/bitrix/redirect.php?goto=https://t.me/s/bonus_za_registratsiyu_bez_depa
cost cheap cipro without prescription
Покупка диплома о среднем полном образовании: как избежать мошенничества?
Drug information for patients. Long-Term Effects.
where to get rizatriptan pill
Everything what you want to know about pills. Read information now.
where to get generic amoxil pills
Medicament information. Effects of Drug Abuse.
where to buy cephalexin pill
Everything trends of medicine. Get now.
Drugs prescribing information. Generic Name.
can i buy generic levitra without dr prescription
Everything trends of medicament. Read here.
Meds information leaflet. Generic Name.
order generic atarax pills
Everything about medicine. Read now.
Medicines information leaflet. Generic Name.
how does metformin decrease hepatic glucose production
Some information about pills. Read now.
Узнайте, как безопасно купить диплом о высшем образовании
niceroleplay.getbb.ru/viewtopic.php?f=1&t=2264
order imdur without a prescription
Парадокс, но купить диплом кандидата наук оказалось не так и сложно
Medicine information. What side effects?
generic fosamax for sale
All information about medicine. Get here.
Seasonal deals on outdoor gear skidki-i-kupony.ru .
автоматические гардины для штор автоматические гардины для штор .