微波EDA网,见证研发工程师的成长!
首页 > 硬件设计 > 嵌入式设计 > SDBC的特殊寄存器(可位寻址的定义方法)

SDBC的特殊寄存器(可位寻址的定义方法)

时间:11-29 来源:互联网 点击:
AT89X52.BI
用于52兼容MCUConst 变量和 Const 变量在编译的时候运算完By 万致远,sdbc 定义可位寻址的数据类型Type SFR_BIT_ADim SFR_BIT_A As sfr 定义字节地址sfr,如果Type里有和Type名一样的变量,则编译器将把它当作默认变量比如说这个type里面有SFR_BIT_A,那么外部给这个类定位地址,事实上是给这个变量定位地址比如Dim P0 As SFR_BIT_A at &H80,那么P0=0就是相当于MOV #80H,0.然后设计如果需要数字变量名,需要在前面加$,但是如果在类外/类型外引用,则不需要,with语句也需要类似P0.0=1。With P0 .$0=1 End With一样在type内的地址声明将在编译时被固定处理,类似声明P0在0x80,那么$0~$7固定为0x80~0x87Dim $0 As sbit at &SFR_BIT_ADim $1 As sbit at &SFR_BIT_A+1Dim $2 As sbit at &SFR_BIT_A+2Dim $3 As sbit at &SFR_BIT_A+3Dim $4 As sbit at &SFR_BIT_A+4Dim $5 As sbit at &SFR_BIT_A+5Dim $6 As sbit at &SFR_BIT_A+6Dim $7 As sbit at &SFR_BIT_A+7End TypeIO口定义Dim P0 As SFR_BIT_A at &H80声明P0在0x80位置Dim P1 As SFR_BIT_A at &H90声明P1在0x90位置Dim P2 As SFR_BIT_A at &HA0声明P2在0xA0位置Dim P3 As SFR_BIT_A at &HB0声明P3在0xB0位置IO口定义结束

Copyright © 2017-2020 微波EDA网 版权所有

网站地图

Top