EmbeddedRelated.com
Forums

Re: Please help with SCI0 interrupt on DEMO9S12NE64

Started by grec...@lafayette.edu May 8, 2013
Under DBug-12 SCI0 interrupts are not available. The document

Reference Guide For D–Bug12 Version 4.x.x
A Debug Monitor For The MC9S12Dx256, MC9S12A256, MC9S12Dx128, MC9S12H256 &
MC9S12A128 Microcontrollers
Written By Gordon Doughman
Field Applications Engineer
Software Specialist

states on page 11: Note that even though there is an entry in the table for SCI0, replacing the default value with the address of an interrupt service routine will be ignored since D-Bug12 requires the SCI0 for all of its communication.

John Greco
Electrical and Computer Engineering Dept.
Lafayette College
Easton, PA

>
>
>
> All,
>
>Please help. I am trying to add SCI0 receive interrupt on DEMO9S12NE64 by
>adding functions to Startup_Demo. This simple function is supposed to reply
>with character received but HC12 always replies "�>". The modifications to
>the original Startup_Demo code are:
>
>in main.c
>//#include "ne64debug.h" //Disable Debug
>#include //add hidef.h
>
>
>//Enable SCI0 with receive SCI0 interrupt, baud is set to 19200
>
>#pragma CODE_SEG DEFAULT
>static void SCI0Init(void) {
>SCI0BDL = (unsigned char)((25000000UL /* OSC freq */) / 19200 /* baud rate
>*/ / 16 /*factor*/);
>SCI0CR2 = 0x2C; //Enable SCI0 Receive Interrupt
>EnableInterrupts;
>}
>
>//SCI0_ISR interrupt routine
>#pragma CODE_SEG __NEAR_SEG NON_BANKED
>interrupt void SCI0_ISR(void){
>unsigned char rc;
>rc = SCI0SR1; /* dummy read to clear flags */
>rc = SCI0DRL; /* data read */
>
>SCI0DRL = rc; //reply the same SCI Data
>}
>
>
>//in the main void main(void) added
>SCI0Init(); //Enable SCI0
>
>In Vectors.c added
>extern void near _EntryPoint(void); /* Startup routine */
>extern void near SCI0_ISR(void); //<-- ADDED this
>
>Removed --> Cpu_Interrupt, /* 43 Default (unused) interrupt
>*/
>In that place added
>SCI0_ISR, /* 43 SCI0 interrupt */
>
>
>
>Why doesn't it works?? Please help.
>
>Your help is very much appreciated.
>Langowski J.
>
>
>
>
>