用cosmic 编译器有这么一句DEF_16BIT_REG_AT(NAME,ADDRESS) volatile unsigned int NAME
@address
对应的是DEF_16BIT_REG_AT(TIM1_CNTR,0x525e);
如果用IAR的话就没办法直接用TIM1_CNTR
/* TIM1 counter high */
__IO_REG8 (TIM1_CNTRH, 0x525E, __READ_WRITE);
/* TIM1 counter low */
__IO_REG8 (TIM1_CNTRL, 0x525F, __READ_WRITE);
#define __IO_REG8(NAME, ADDRESS, ATTRIBUTE)
__near __no_init volatile ATTRIBUTE unsigned char NAME @ ADDRESS;
#define __IO_REG16(NAME, ADDRESS, ATTRIBUTE)
__near __no_init volatile ATTRIBUTE unsigned int NAME @ ADDRESS;
__IO_REG16 (TIM1_CNTR, 0x525E, __READ_WRITE);
这样编译没错,一旦用了TIM1_CNTR就报错
有什么办法能和cosmic一样用么?
此帖出自
小平头技术问答
一周热门 更多>