We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Can anybody help me to explain the following sequence ? I only had some expericence in coding x86 Assembly. #pragma asm CLR TR0 MOV A,#K_Timer0IntervalCompLo ADD A,TL0 MOV TL0,A MOV A,#K_Timer0IntervalCompHi ADDC A,TH0 MOV TH0,A NOP NOP NOP NOP SETB TR0 #pragma endasm Thanks. EricLin eric.yc.lin@liteon.com
These instructions stop 16-bit timer 0 to prevent its two 8-bit registers (TH0 and TL0) from changing while the MSB and LSB of a 16-bit "reload" constant (K_Timer0IntervalCompHi and K_Timer0IntervalCompLo) are added into that register pair. The NOPs presumably pad the timing out to match the reload, then the timer is started back up again.
Thanks, Dan.