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。
内容来自互联网摘抄
侵删
Medication information sheet. Short-Term Effects.
how can i get cheap zoloft without insurance
Everything what you want to know about medicine. Read here.
what is a safe dose of prednisone long term
Drug prescribing information. What side effects?
can you get generic levonorgestrel pills
All trends of medication. Get here.
Drugs information leaflet. What side effects can this medication cause?
can i buy proscar no prescription
Best what you want to know about pills. Get now.
doxycycline 200mg cheap
Drug information sheet. What side effects can this medication cause?
famotidine use and thrombocytopenia in the trauma patient
All what you want to know about medication. Read here.
Meds prescribing information. Short-Term Effects.
hydrochlorothiazide and urinary incontinence
Some about medicament. Get information here.
how to get cheap super p-force without dr prescription
Drug prescribing information. Drug Class.
cost of zithromax 500 mg
All about meds. Read information now.
Medicament information for patients. Generic Name.
cephalexin without insurance
All information about medicine. Get now.
can i purchase generic aristocort without insurance
Drug information for patients. Drug Class.
where to buy atarax for sale
Some about meds. Get here.
Medicine information sheet. Generic Name.
where to get generic tadacip pills
All trends of pills. Get now.
drut 6 waga
Medicine prescribing information. Brand names.
can you buy fexofenadine online
Some what you want to know about pills. Get here.
Medicine information leaflet. Drug Class.
how to get cheap sumatriptan online
Actual about drugs. Get information here.
casino or slot machine or igaming
can i purchase proscar pill
Pills information sheet. What side effects can this medication cause?
can i purchase motrin without prescription
Best news about drugs. Get now.
how can i get zoloft prices
Drugs prescribing information. Drug Class.
can i buy cheap dramamine without insurance
Actual what you want to know about medicines. Read here.
Всё, что нужно знать о покупке аттестата о среднем образовании без рисков
Meds information leaflet. Cautions.
order cheap tadacip
Everything about medication. Read information now.
Drug information leaflet. Long-Term Effects.
get generic zoloft pills
Actual information about medicine. Read information here.
Узнайте, как приобрести диплом о высшем образовании без рисков
Аттестат школы купить официально с упрощенным обучением в Москве
Парадокс, но купить диплом кандидата наук оказалось не так и сложно
Удивительно, но купить диплом кандидата наук оказалось не так сложно
прокапать от алкоголя на дому воронеж прокапать от алкоголя на дому воронеж .
клиника от запоя клиника от запоя .
вывод из запоя лечение королев https://vyvod-iz-zapoya-korolev14.ru/ .
прерывание запоя цена прерывание запоя цена .
срочная помощь вывод из запоя королев http://vyvod-iz-zapoya-korolev13.ru/ .
Drugs information sheet. Short-Term Effects.
buying cheap zithromax for sale
Some news about drug. Read here.
where to get cheap celebrex pill
cost of sildalist without rx
Medication information. Drug Class.
where buy cheap atarax for sale
All news about meds. Read information now.
Drugs information. Long-Term Effects.
can i buy cheap ceftin without a prescription
Some trends of medication. Read information now.
Pills information leaflet. Short-Term Effects.
how to buy cheap zanaflex without prescription
Best trends of drugs. Get information now.
купить диплом техникума в самаре many-diplom77.ru .
Drug information for patients. Effects of Drug Abuse.
how can i get generic zanaflex without dr prescription
All about medicines. Read information now.
hayatının en iyi vaktini geçirebileceğin tek site fatih escort sitesi https://fatihescortbul.com
Medicines information leaflet. Drug Class.
promethazine and trazodone
Best information about medicament. Read information now.
where to buy celebrex without insurance
Medication information for patients. Drug Class.
can you get generic ipratropium price
Everything information about medicament. Read now.
Medication information. What side effects can this medication cause?
how to buy cheap tamoxifen pills
Actual information about medicines. Read here.
can i order finasteride pill
Pills information for patients. Drug Class.
promethazine dm syrup with ibuprofen
Best about drugs. Read here.
Medicament information leaflet. What side effects can this medication cause?
can you get cheap ramipril price
Actual about drugs. Read now.
Drugs information. What side effects?
cost singulair without prescription
Some news about pills. Get here.