----- Original Message ----- From: "Stefan Brandt" <> To: "HC12_Newsgroup" <> Sent: Friday, April 18, 2003 12:56 PM Subject: [68HC12] Problems with ICC12-HC12-RTi-interrupts > hello! > > today i am first time here and hope someone will help me ;-) > > it is even the first tim using interrupthandlers, so i am still > unexperienced ;-( > i tryed to edit a small program, which flashes a LED in defined cycles, but > the ICC12 compiler does not translate the code to a *.S19 file. If you are unhappy with ICC12 go Help->About->MailingLists. > the problemlien is marked by many: !!!!!!!!!!!!! > > what is wrong in my program? > > Thanx!!! > > Stefan > here the program: > > #define RTICTL _P(0x14) > #define RTIFREG _P(0x15) _P macro is undefined before #include <HC12.h> > #include <HC12.H> > int x; > int counter; > void delay(x)//x=1 entspricht ca. 0.0016ms > { > > while (x!=0) > { > x--; > } > } > > #pragma interrupt_handler RTIhandler > void RTIhandler (void) > { > int a; > > RTIFREG &=~ 0x80; RTIFLG must be cleared by writing '1' to flag position. Try RTIFREG=0x80 or RTIFREG&=0x80 if last compiles to BCLR RTIFREG,#0x7F. Your code generates BCLR RTIFREG,#0x80 and doesn't clear RTIFLG! Edward > > if (counter < 10) > { > counter++; > } > else > { > counter=0; > a0; > while(a!=0)//led flashes > { > PORTT|=0x08; > delay(32000); //fHz > PORTT&=~0x08; > delay(32000); > a--; > } > } > } > > //vectoraddress for RTIhandler > #pragma abs_address: 0xfff0 > void (*RTI_vector[])()={RTIhandler};//in this line the compiler says:!!!!!!!!!!!!!!!!!!!!!!!!!!!!! > //'declaring a function without prototype may cause errors' !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! > > #pragma end_abs_address > > void main(void) > { > DDRT=0xFF; > asm("CLI \n"); > RTICTL=0x07; //Adresse 0014 / t4.072ms @ 4MHz > counter=0; > > } > /********* vectors.c ***********************/ > > /* As is, all interrupts except reset jumps to 0xffff, which is most > * likely not going to useful. To replace an entry, declare your function, > * and then change the corresponding entry in the table. For example, > * if you have a SCI handler (which must be defined with > * #pragma interrupt_handler ...) then in this file: > * add > * extern void SCIHandler(); > * before th table. > * In the SCI entry, change: > * DUMMY_ENTRY, > * to > * SCIHandler, > */ > #if defined(_HC12) > /* add any interruot vectors in here too for HC12 paged compilation > */ > #pragma nonpaged_function _start > #endif > extern void _start(void); /* entry point in crt??.s */ > > #define DUMMY_ENTRY (void (*)(void))0xFFFF > > #pragma abs_address:0xffd0 > > /* change the above address if your vector starts elsewhere > */ > void (*interrupt_vectors[])(void) = > { > /* to cast a constant, say 0xb600, use > (void (*)())0xb600 > */ > /* 812A4 vectors starts at 0xff80, but most entries are not used > if you use Key Wakeup H, change the start address to 0xffCE and > add one entry to the beginning */ > DUMMY_ENTRY, /* BDLC */ /* Key Wakeup J */ > DUMMY_ENTRY, /* ATD */ /* ATD */ > DUMMY_ENTRY, /* RESERVED */ /* SCI 1 */ > DUMMY_ENTRY, /* SCI */ > DUMMY_ENTRY, /* SPI */ > DUMMY_ENTRY, /* PAIE */ > DUMMY_ENTRY, /* PAO */ > DUMMY_ENTRY, /* TOF */ > DUMMY_ENTRY, /* HC12 TC7 */ > DUMMY_ENTRY, /* TC6 */ > DUMMY_ENTRY, /* TC5 */ > DUMMY_ENTRY, /* TC4 */ > DUMMY_ENTRY, /* TC3 */ > DUMMY_ENTRY, /* TC2 */ > DUMMY_ENTRY, /* TC1 */ > DUMMY_ENTRY, /* TC0 */ > RTIhandler, /* RTI */ > DUMMY_ENTRY, /* IRQ */ > DUMMY_ENTRY, /* XIRQ */ > DUMMY_ENTRY, /* SWI */ > DUMMY_ENTRY, /* ILLOP */ > DUMMY_ENTRY, /* COP */ > DUMMY_ENTRY, /* CLM */ > _start /* RESET */ > }; > #pragma end_abs_address > > /**********Ende vectors.c*****************************/ |