eSteve

Newbie - Starting a timer and reading timer counter TCN on a 68302

Discussion created by eSteve on Sep 30, 2008
Latest reply on Oct 2, 2008 by eSteve
I am trying to start timer2 and read the timer counter value (TCN2), once I have started the timer I am expecting to the see the TCN2 value incrementing, but I see no change in the TCN2 value.  I am starting the timer thus:
 
/* This is the timer 2 mode register set up -
   000B hex, 11 decimal or
   0000 0000 0000 1011 binary -
   PS   = (0000 0000) divide the clock by 1,
   CE   = (00) disable int on capture,
   OM   = (0) active low pulse for one clock cycle (62.5ns),
   ORI  = (0) enable interrupt on reaching reference val,
   FRR  = (1) reset count on timeout,
   ICLK = (01) source - master clock,
   RST  = (1) enable timer */

#define SETTIMER2MODE 0x000B
#define TCN2  0x856
#define TMR2  0x850
 
/* Set up the timer 2 mode register */
Poke16(BASE + TMR2, SETTIMER2MODE);
 
Poke is a library function, which works since I can see the value 0x000B at the address of 0x850 + BASE
 
So as I understand it Timer2 should now be running and will roll round when it reaches 65535.
 
When running in the simulator I then examine TNC1 expecting it to be incrementing in time with the clock but there is no value at TCN2.
 
What's wrong?  Any ideas anyone?  Thanks.
 
Compiler - Cosmic IdeaCPU32
Simulator - Cosmic ZAP

Outcomes