I have purchased a dragon12 board and I'm programming in C using CW. I'm having problems with the interrupts. I'm trying to initiate and interrupt when the 16 bit timer overflows. Stepping through the code, it seems that no interrupts are initiated and program runs in the infinite loop in the main function.
I have attached my code in a text file. It’s only a few lines.
#include <hidef.h> /* common defines and macros */
#include "derivative.h" /* derivative-specific definitions */
volatile unsigned int n;
volatile unsigned int x;
DDRB = 0xFF; //PORTB as output since LEDs are connected to it
DDRJ = 0xFF; //PTJ as output to control Dragon12+ LEDs
PTJ=0x0; //Allow the LEDs to display data on PORTB pins
TSCR2=0x87; /*TCNT prescaler + enable interrupt */
TSCR1=0x80; //enable system timer
TFLG2 = 0x80; /*clear Timer Interrupt Flag bit by writing a 1 to bit 7*/
#pragma CODE_SEG __NEAR_SEG NON_BANKED /* Interrupt section for this module.
Placement will be in NON_BANKED area. */
interrupt void TimerOverflow_ISR(void)
TFLG2=0x80; /* clear Timer Interrupt Flag bit by a write*/