lgwd 发表于 2023-3-2 16:29:15

我应该用哪个STC8H.H头文件:

新的STC8H.H文件较去年上半年的STC8H.H文件有变化:
2022.05.20的 STC8H.H 文件
#define   RSTFLAG               (*(unsigned char volatile xdata *)0xfe09)
在2023.02.16的 STC8H.H 文件
#define   RSTFLAG               (*(unsigned char volatile xdata *)0xfe99)

2023.02.16的 STC8H.H 文件
#define   SPFUNC                  (*(unsigned char volatile xdata *)0xfe98)
#define   ADCEXCFG                (*(unsigned char volatile xdata *)0xfead)
#define   CMPEXCFG                (*(unsigned char volatile xdata *)0xfeae)
在2022.05.20的 STC8H.H 文件中没有

2022.05.20的 STC8H.H 文件
#define   PIN_IP                  (*(unsigned char volatile xdata *)0xfd60)
#define   PIN_IPH               (*(unsigned char volatile xdata *)0xfd61)
在2023.02.16的 STC8H.H 文件中改为
#define   PINIPL                  (*(unsigned char volatile xdata *)0xfd60)
#define   PINIPH                  (*(unsigned char volatile xdata *)0xfd61)
2023.02.16的 STC8H.H 文件还增加了下面一行:
#define   CHIPID                  ( (unsigned char volatile xdata *)0xfde0)


2022.05.20的 STC8H.H 文件
#define   DBLNTH                  (*(unsigned char volatile xdata *)0xfb82)
#define   COMLNTHL                (*(unsigned char volatile xdata *)0xdb83)
#define   COMLNTHM                (*(unsigned char volatile xdata *)0xfb84)
#define   COMLNTHH                (*(unsigned char volatile xdata *)0xfb85)
#define   BLINKFRPS               (*(unsigned char volatile xdata *)0xfb86)
在2023.02.16的 STC8H.H 文件中改为:
#define   DBLEN                   (*(unsigned char volatile xdata *)0xfb82)
#define   COMLENL               (*(unsigned char volatile xdata *)0xfb83)
#define   COMLENM               (*(unsigned char volatile xdata *)0xfb84)
#define   COMLENH               (*(unsigned char volatile xdata *)0xfb85)
#define   BLINKRATE               (*(unsigned char volatile xdata *)0xfb86)

2022.05.20的 STC8H.H 文件
#define   COM_ON_A                (*(unsigned char volatile xdata *)0xfb88)
#define   COM_ON_B                (*(unsigned char volatile xdata *)0xfb89)
#define   SEG_ON_A                (*(unsigned char volatile xdata *)0xfb8a)
#define   SEG_ON_B                (*(unsigned char volatile xdata *)0xfb8b)
#define   SEG_ON_C                (*(unsigned char volatile xdata *)0xfb8c)
#define   SEG_ON_D                (*(unsigned char volatile xdata *)0xfb8d)
#define   SEG_ON_E                (*(unsigned char volatile xdata *)0xfb8e)
在2023.02.16的 STC8H.H 文件中改为:
#define   COMON                   (*(unsigned char volatile xdata *)0xfb88)
#define   SEGON1                  (*(unsigned char volatile xdata *)0xfb8a)
#define   SEGON2                  (*(unsigned char volatile xdata *)0xfb8b)
#define   SEGON3                  (*(unsigned char volatile xdata *)0xfb8c)
#define   SEGON4                  (*(unsigned char volatile xdata *)0xfb8d)
#define   SEGON5                  (*(unsigned char volatile xdata *)0xfb8e)
其中还少了对应一行:#define   COM_ON_B                (*(unsigned char volatile xdata *)0xfb89)

2023.02.16的 STC8H.H 文件增加了:
//USB Control Regiter

//Interrupt Vector

#define NOP1()_nop_()
等增加了约230行。
可以用日期更新的STC8H.H文件替代之前的文件吗?

电子DIY小家 发表于 2023-3-2 17:14:18

粗看了一下最新的头文件主要就是新增了一些寄存器和重命名了一些寄存器,你要想替换的话就替换咯,之前用到的寄存器如果名字改掉了就吧程序里用到的地方改成最新的,按照地址去对应就好了,如果是新建工程建议用新的,如果是老工工程增加项目可以沿用老的,需要用到的刚好又没有的几个寄存器自己手动定义一下好了。

lgwd 发表于 2023-3-2 20:21:05

谢谢回复!我买了几块打狗棒,为学习USB口连接的相关技术。下载了STC8H8K64U实验箱9.3的程序包。学习其中的HID协议范例。源程序是去年5月STC开发的,其中的STC头文件与现在新的有所不同。刚才将原来定义的符号在程序中全部搜索了一遍,没有发现使用,这样也不用修改了。替换了新的头文件,编译后显示无错误无警告。日后学通了就用到仪器上试试。
页: [1]
查看完整版本: 我应该用哪个STC8H.H头文件: