//Sending "YES" to Hyperterminal (or Tera Terminal) via Serial COM0 (SCI0) on HCS12 MCU Module //The HCS12 MCU Module comes with one serial port with DB-9 connector ready to go. //On HCS12 MCU Module, the SCI0 pins of TX and RX of HCS12 are connected to DB-9 COM port //It is done via a MAX232-compatible chip for converting TTL to RS232. //They SCI0 signales are accessed via both COM-USB and COM_EN jumpers. They are located close to USB connection. //Make sure COM-USB and COM_EN jumpers are set. Also Make sure VB jumper for PWR_SEL is set too //Also make sure the VB jumper for Power_SEL (next to power jack) is set since it is powered via USB cable //connect the COM port of MCU Module to COM port of x86 PC via a via null serial cable. //If you do not have COM port on your x86 PC, then you need a USB-COM converter. //Configure the Hyperterminal (for XP) or Tera Terminal (for Vista or Windows 7. See tutorial on this website). //Modfied from Example 10-9 in HCS12 textbook by Mazidi & Causey //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 }