i want to use the pulse accumulator such that it generate an interrept
after it counts 128 rising edges.
My code seems to never generate an interrupt. I am using codewarrior
as a compiler and here is the code:
lcd_goto(Line1, 0);
lcd_puts("Value = ");
put_num((unsigned int)count);
/*Bsm Allah Al-Rahman Al-Raheem*/
#include
/* common defines and macros */
#include /* derivative information */
#include "pll.h" /* defines _BUSCLOCK, sets bus frequency to
_BUSCLOCK MHz */
#define Line1 0x80 // Line1 address in LCD
#define Line2 0xc0 // Line2 address in LCD
#define CMD 0
#define N 128 //Value to be loaded in PACA
#pragma LINK_INFO DERIVATIVE "mc9s12dp256b"
float count;
void initPA(void){
PACN32 = -N;
PACTL = 0x52; /* enable PA function, enable PAOV interrupt */
//DDRT &= 0x7F; /* configure the PT7 pin for input */
DDRB |= 0x01; /* Debug purpose pin 0 output will be utilized to
toggle at 60 pulse counts*/
//overflow = 0;
count=0;
}
void main(void){
/* set system clock frequency to _BUSCLOCK MHz (24 or 4) */
PLL_Init();
/* Initialize LCD module */
initLCD();
/*Initialize Pulse counter A*/
initPA();
PORTB=0;
asm("cli")
/* forever */
for(;;) {
}
}
interrupt 17 void PAOF_ISR(void) {
PAFLG = PAFLG_PAOVF; /* clear PAOVF flag */
PACN32 = -N;
count=count+1;
PORTB ^= 1; // Toggle pin 0
lcd_goto(Line1, 0);
lcd_puts("count = ");
put_num((unsigned int)count);
}
Thank you in advance
______________________________
Stellaris® MCU Family: New Parts, New Package, New Price.

(You need to be a member of 68hc12 -- send a blank email to 68hc12-subscribe@yahoogroups.com )