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

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

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

1,003 Views
eclipselynn
Contributor I
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;
Labels (1)
0 Kudos
1 Reply

292 Views
JimDon
Senior Contributor III
Sample Programs
Scroll down to find some sample programs.
These examples are know to work.


0 Kudos