yi lin

Ask for:how to use the SCI interrupt mode in 9s12DG128B with C language?

Discussion created by yi lin on Nov 2, 2007
Latest reply on Nov 3, 2007 by Jim Donelson
Dose anyone know how to use SCI interrupt mode with C language ?
My programme is as follows,but it doesn't work when connectted to a PC......"-_-
Please give me a example or find out the my errors....
 
9SDG128B
 
#include <hidef.h>      /* common defines and macros */
#include <mc9s12dg128.h>     /* derivative information */
#pragma LINK_INFO DERIVATIVE "mc9s12dg128b"
char a;
void sci_put(char c)
{if((SCI0SR1&0x80)==0)
 SCI0DRL=c;
}
char sci_get()
{if((SCI0SR1&0x20)==0)
 return(SCI0DRL);
}
void main(void) {
  /* put your own code here */
  SCI0BD=0x34;//set BDR=9600
  SCI0CR1=0xA0;
  SCI0CR2=0xAC;
  EnableInterrupts;
  for(;:smileywink: {} /* wait forever */
  /* please make sure that you never leave this function */
}
interrupt void sci(void)
{sci_get();
 sci_put(a);
}
const unsigned int
vector@0xFFD6=(const unsigned int)&sci;

Outcomes