Sign in

username:

password:



Not a member?

Search 68hc12



Search tips

Subscribe to 68hc12



68hc12 by Keywords

68HC1 | 812A4 | 9S12DP256 | Bootloader | CodeWarrior | D60A | Debugger | DP256 | ECT | EEPROM | EVB | Flash | HC1 | HCS12 | I2C | IAR | ICC1 | Interrupts | LCD | M68KIT912DP256 | MC9S12DP256 | MC9S12DP256B | Metrowerks | Motor | MSCAN | Multilink | PLL | Quadrature | SDI | SPI | Transceiver | XFC

Ads

Discussion Groups

Discussion Groups | 68HC12 | pulse accumulator

Join our technical discussions about Freescale Microcontrollers: M68HC12. (Freescale Semiconductor is a Subsidiary of Motorola).

pulse accumulator - xreemiex - Mar 10 7:52:24 2008

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



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