1. SBIT Assembler Statement
(keil 中 help 的说明)
Arguments sbit sfr_symbol = bit-address;
Description The sbit statement defines a special function register bit:
Where
*sfr_symbol is the name of the Special Function Register (SFR) symbol to define.
bit-address is the address of the SFR bit in the format address^bit_position.*
The sbit statement allows you to define SFR bit data in a consistent manner with the Cx51 compiler. With this statement you may use a generic SFR register definition file for the Cx51 compiler and the Ax51 assembler.
Example
sbit P0_0 = P0^0;
sbit P0_1 = 0x90^1;
理解
sbit 用于特殊功能寄存器中可位寻址的位地址。类似于C语言中的宏定义,对选定位地址进行某特殊功能的命名。
格式为:sbit 命名功能 = 位地址
2. SFR Assembler Statement
Arguments sfr sfr_symbol = address;
Description The sfr statement defines a special function register:
- Where
*sfr_symbol is the name of the Special Function Register (SFR) symbol to define.
address is the address of the SFR.*
The sfr statement allows you to define SFR data in a consistent manner with the Cx51 compiler. With this statement you may use a generic SFR register definition file for the Cx51 compiler and the Ax51 assembler.
Example
sfr P0 = 0x80;
sfr P1 = 0x90;
理解
sfr 定义特殊功能寄存器中的字节。类似于C语言中的宏定义,对选定字节地址进行某特殊功能的命名。
格式为:sfr 功能命名 = 地址(位地址首位)
3. 51中可位寻址区域
1)位寻址区
字节地址范围为 20H~2FH,
这16个单元(共计128位)的每一位都有一个对应位地址,
位地址范围为 00H~7FH。
2)SFR区
字节地址范围为80H~FFH,
字节地址30H~7FH为数据缓冲区,用户RAM区,
位地址范围紧接上述位寻址区位地址范围,SFR区位地址范围为 80H~FFH。
- 注:凡是SFR中字节地址能被8整除的单元均能位寻址。