Yuval Klein

9s12dp256 serial com

Discussion created by Yuval Klein on Oct 29, 2006
Latest reply on Oct 31, 2006 by Yuval Klein
Hi,
I wrote a code with ICC12 to receive serial com on SCI1 and display it
on the screen (prinf) using interrupt. all I'm getting is a range of
values between 252 and 255. why?
here is my code:

#include
#include

void initialize(void);
void sci_isr (void);
unsigned int rxData;
unsigned int i; /* the message received. */

#pragma interrupt_handler sci_isr

//Serial Com 1 Interrupt
void sci_isr (void){
if (SCI1SR1&0x20){ rxData = SCI1DRL; /* The receiver is full. Read a byte. */
printf(" %d \r", rxData);}
}
}

void initialize(){
i=0;
SCI1BDL=156;SCI1BDH=0x00; //Set Boud rate to 38,400
SCI1CR1=0x00;
SCI1CR2=0x24; //enable SCI reciever interrupt
*(void (**)())0x3fd4=sci_isr; //Serial Com. #1 interrupt
asm("cli");
}

void main (void){
initialize();
while(1){}
}

Outcomes