|
TxCON最高位导致的2812 TxPR寄存器写失败
[复制链接]
CCS仿真环境中,2812的TxPR寄存器的值更新会受TxCON里最高位(free位,为0表示仿真挂起会使计时停止,为1则计时不受挂起影响)影响。而TxCMPR里的值不受该位影响。如下面的程序代码:
EvaRegs.T2PR = 0x0080;
EvaRegs.T2CMPR = 0x0040;
EvaRegs.T2CON.all = 0x1546; // Free = 0
EvaRegs.T2PR = 0x0090;
EvaRegs.T2CMPR = 0x0x0050;
执行后T2PR = 0x0080; T2CMPR = 0x0x0050;
将TxCON里free位改为1:
EvaRegs.T2PR = 0x0080;
EvaRegs.T2CMPR = 0x0040;
EvaRegs.T2CON.all = 0x9546; // Free = 1
EvaRegs.T2PR = 0x0090;
EvaRegs.T2CMPR = 0x0x0050;
执行后T2PR = 0x0090; T2CMPR = 0x0x0050;
|
|