Hi:
the datasheet mentioned that (as for TCNT) "Write: Has no meaning or effect in the normal mode; only writable in special modes ."what exactly does "special modes" mean? debug mode?
my code:
uint16_t uValue = (uint16_t)getReg16(TIM0TCNT);
setReg16(TIM1TCNT,0);
I used to get the timer0 tick count,it works well in debug,but it won't work on its own.
does any one know how to solve the problem?
MIKI
Usually we debug in special operating mode. But we can also debug (yes, over BKGD pin) in normal operating mode.
It is simpler for us if debugger pulls BKGD/MODC low and pulses /RESET low. MCU in this case resets and stops waiting for BDM commands send via BKGD pin. But you may also let debugger connect to already running MCU (in normal mode), then for example perform nonintrusive read of memory or pause execution etc.
TCNT is not writeable in normal operating modes. So your subject is wrong, you read TIM0TCNT well but your write to TIM1TCNT is ignored in normal mode.
Edward