Hi,
I'm working with a MC9S12DP256 using TC4 as output compare, but I encounter troubles with the free run counter TCNT. This is how I initialize the timer :
// Enable Timer 4 for 1ms clickTIOS = 0x10; TIE_C4I = 1;TSCR1_TEN = 1;TSCR1_TSWAI = 1;TSCR1_TSFRZ = 1;// Run timerTC4 = OS_TIMER_PERIOD;
I use CodeWarrior 5.9 under Vista, and TCNT is never incremented, the simulator indicates the value "undefined" for it, whereas it works well at school with CodeWarrior 3.1 under XP...What's the problem ?
Regards.
Jonathan
In true time simulator menu "HCS12 FCS"->"Set Derivative...", try selecting MC9S12DP256B.
Also if you used project wizard, included "derivative.h" should contain something like this:
#pragma LINK_INFO DERIVATIVE "mc9s12dp256b"
If you don't want to include derivative.h, then try adding above pragma to one of your *.c files.
I tried to replace the following pragma in "derivative.h" :
#include <mc9s12dp256.h>#pragma LINK_INFO DERIVATIVE "mc9s12dp256"
by
#include <mc9s12dp256.h>#pragma LINK_INFO DERIVATIVE "mc9s12dp256b"
and it works ! Thanks for your help !
Jonathan.
Then TCNT should run. It works OK for me with all your settings listed above, TCNT advances properly while stepping or running.