//Sending "YES" to Hyperterminal (or Tera Terminal) via Serial COM0 (SCI0) on Project Board //Modfied from Example 10-3 in HCS12 textbook by Mazidi & Causey //On the Project Board, we have a serial COM port with DB-9 connector. //The Serial COM port on Project Board is connected to the TX0 and RX0 (SCI0) of HCS12 permanently via a MAX232-compatible chip //Serial COM PORT on Project Board is accessible by the HCS12 MCU Module via jumper called COM_SEL. //The COM_SEL jumper is located in front of the DB-9 connector and allows the MON08 or COM selection.. //MAKE SURE the jumper is set for the COM instead of MON08 in the COM_SEL jumper of Project Board before running this program. //MAKE SURE 4 jumpers for COM_EN on the Project Board are also set. The COM_EN jumpers are located next to DB-9 connector. //In codeWarrior, MAKE sure you are in TBDML Mode before downloading //Press F7 (to Make), then F5(Debug) to downLOAD,and F5 once more to start the program execution #include /* common defines and macros */ #include "derivative.h" /* derivative-specific definitions */ void SerTx0(unsigned char); void main(void) { /* put your own code here */ SCI0BDH=0x00; //XTAL=4MHz SCI0BDL=13; //4MHz/2=2MHz, 2MHz/16=125,000 and 125,000/9600=13 SCI0CR1=0x00; SCI0CR2=0x0C; for(;;) { SerTx0('Y'); SerTx0('E'); SerTx0('S'); SerTx0(' '); } } void SerTx0(unsigned char c) //SCI0 (COM0 of HCS12 chip) { while(!(SCI0SR1 & 0x80)); //make sure the last bit is gone SCI0DRL=c; //before giving it another byte }