Pulse Accumulator

Started by yklein2004 November 16, 2006
Hi,

I'm trying to count pulses from wheel encoder. I'm using ICC12 and
MC9S12DP256. The problem I'm having is that the result (PANC1) does
not make any sense. The number are not in sequence.(ex. 179, 254, 18...)
here is my code, Please help.

#include
#include

void initialize(void);

void main(void){
initialize();
while (1){
printf(" %u \r",PACN1);
}
}

void initialize(){
DDRT = 0x00; /* configure all timer port pins for input */
TCTL4 = 0x04;
ICPAR = 0x02; //set PACN1 to count W.E
}