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。
内容来自互联网摘抄
侵删
how to get celebrex no prescription
Тут можно преобрести оружейный шкаф сейф купить оружейный шкаф купить в москве
Medicine information for patients. What side effects?
metoprolol tab 500mg
Some trends of pills. Read information here.
Medication information for patients. Effects of Drug Abuse.
is hydroxyzine safe for long term use
All news about medicines. Read now.
поддельный диплом поддельный диплом .
красная поляна прокат лыж 2024 прокат лыж и сноубордов Красная поляна
iphone купить минск купить iphone в рассрочку
Pills information for patients. What side effects?
can you buy ampicillin without rx
All news about medication. Read information here.
buy remeron no prescription
Medicament prescribing information. What side effects?
can i get minocycline pill
All trends of drug. Read here.
Medication information. Drug Class.
can i buy coumadin without prescription
Best information about medication. Read information here.
Medicine information. What side effects can this medication cause?
finasteride barato chile
Best news about meds. Get information now.
can i get generic fincar without a prescription
Medicine information. Brand names.
where to get generic nolvadex without rx
All what you want to know about drug. Get information here.
Pills information leaflet. Cautions.
duloxetine amphetamine
Best about medicines. Read here.
Medicines prescribing information. Drug Class.
cost of rogaine
Actual about medicines. Read here.
anon ig viewer http://www.storyinst.com .
Drugs prescribing information. Short-Term Effects.
how can i get cheap minocycline online
Some trends of meds. Get here.
I don’t normally comment but I gotta tell appreciate it for the post on this one :D.
my webpage … http://ttps://www.Johnsonclassifieds.com%2Fuser%2Fprofile%2F163068
Быстрая схема покупки диплома старого образца: что важно знать?
Medicines information. Brand names.
get cheap lyrica online
Some trends of medicine. Get information now.
Drug information leaflet. Brand names.
can a doctor prescribe spironolactone
Everything trends of medicament. Read here.
cefixime antibiotic tablets for acne
Pills information leaflet. What side effects can this medication cause?
how to buy generic colchicine tablets
All trends of drugs. Get now.
Всё о покупке аттестата о среднем образовании: полезные советы
Pills information leaflet. Brand names.
patient education contrast media metformin
Everything what you want to know about drugs. Get information here.
Pills information leaflet. Generic Name.
can you get generic olmesartan pill
Actual what you want to know about drugs. Get now.
where can i get generic furosemide without dr prescription
Тут можно преобрести сейф для карабина купить сколько стоит сейф для ружья
Meds information. Long-Term Effects.
can i get xenical no prescription
Some information about medicine. Read now.
Парадокс, но купить диплом кандидата наук оказалось не так и сложно
Medicament information leaflet. What side effects can this medication cause?
order cipro without a prescription
Some information about medicament. Get information now.
промокод на подключение модуля Getcourse Pay http://platezhnyj-modul-getkurs-promokod.ru/ .
Купить диплом о среднем полном образовании, в чем подвох и как избежать обмана?
Drugs information for patients. Drug Class.
can you get cheap tadacip without dr prescription
All trends of pills. Read information now.
Drug information sheet. Brand names.
can i order generic tamoxifen pill
All information about pills. Get here.
Онлайн казино Казино
Как приобрести диплом техникума с минимальными рисками
Medicament prescribing information. Brand names.
zoloft tablet doses
Best news about medicine. Get information here.
Получите бонус и начните с промокод лаки джет.
cost generic artane
Pills prescribing information. Drug Class.
order cheap glucophage pills
Some trends of meds. Get now.
Купить диплом старого образца, можно ли это сделать по быстрой схеме?
Medicine information for patients. Short-Term Effects.
how can i get cheap colchicine without a prescription
Actual what you want to know about meds. Get information here.
Medicament prescribing information. Brand names.
where buy generic diflucan without a prescription
Actual information about medicines. Read now.
Medicines information for patients. Generic Name.
where to get cheap verapamil without insurance
Everything what you want to know about medicines. Get information now.
Drug information for patients. Cautions.
can you buy levitra without rx
Best what you want to know about drug. Get information here.
Покупка диплома о среднем полном образовании: как избежать мошенничества?
Meds information for patients. Brand names.
g6pd deficiency azithromycin
Actual news about pills. Read information here.
прокат лыж в Адлере прокат лыж красная поляна