AnsweredAssumed Answered

SCI recieve interrupt problem

Question asked by chris luteran on Apr 5, 2010
Latest reply on Apr 6, 2010 by Ravishankar N

I am currently using a minidragon board with a MC9S12DG256 chip (HCS12).  I am trying to get an interrupt executed when some other unit sends anything through the serial port.  I have set the interrupt to take what information was recieved and send it back but I get three outputs instead.  Here the hex input is the 0x34 and the output is the following 6 hex numbers. 

 

 

 

{34}

 

{E1}{01}{3E}

 

 

The Following is the code I used and is shortened for simplicity.  Be aware that I have set up the clock and the baud rate to 9600 and they both work because without interrupts they work beautifully.

 

 

 

 

#include <hidef.h>      /* common defines and macros */
#include <mc9s12dg256.h>     /* derivative information */
#include <math.h>

 

#pragma LINK_INFO DERIVATIVE "mc9s12dg256b"

 

 

 

 

void interrupt 20 handler(){ 
     perint();

 

}

 

 

 

void main(void) {
      clkinit();
      delay();
      initsciint();   

 

      EnableInterrupts;        
while(1){}

 

}

 

 

 

void perint(void){
 
  datain = inchar0();
  outchar0(datain);
}

 

void initsciint(void){  
    SCI0CR1 = 0x40;  //setup sci port0  interrupts
    SCI0CR2 = 0x2C;
    SCI0BDH = 0x00;
    SCI0BDL = 0x9C;
}

 

void clkinit(void){  //set up eclock 24MHz

 

    SYNR = 0x02;  
    REFDV = 0x01;
    CLKSEL = 0x00;
    PLLCTL = 0xF1;
    delay();
    CLKSEL = 0x80;
}

 

Thanks for any help!

Outcomes