AnsweredAssumed Answered


Question asked by bleakware on Oct 8, 2012
Latest reply on Oct 9, 2012 by bleakware

Hello all,

I have recently started programming hcs08 micro controllers  At the moment I am learning using a DEMOJM board. I want to initialize the SCI module on the JM60 chip. This is what I have written so far:


#include <hidef.h>      /* common defines and macros */ #include "derivative.h"      /* derivative-specific definitions */ #include "hcs08.h" void SerTx0(unsigned char); void SCI1_OutString(char *pt); void MSDelay(unsigned int); void main(void)  {     SOPT1 = bBKGDPE;                    SCI1BDH=0x00;        SCI1BDL=26;     //8MHz/2=4MHz, 4MHz/16=250,000 and 250,000/9600=26      SCI1C1=0x00;     SCI1C2=0x0C;           for(;;){           SCI1_OutString("a");           } } void SerTx0(unsigned char c)  //SCI0 (COM0 of HC08 chip)   {     while(!(SCI1S1 & 0x80));  //make sure the last bit is gone     SCI1D=c;       //before giving it another byte   }   // Function for writing a string into the sci tx buffer void SCI1_OutString(char *pt) {   while(*pt) {     SerTx0(*pt);     pt++;   }   } void MSDelay(unsigned int itime)  //msec delay   {     unsigned int i; unsigned int j;     for(i=0;i<itime;i++)       for(j=0;j<4000;j++);   }



I also built my own RS232 board to interface with the chip. Check out the pictures.



The problem is I am getting alot of garbage out of my Tx line on my terminal screen which makes me think I have set up my baud rate incorrectly on my code.

I also though my board was wired incorrectly but once I connect it to a HCS12 chip and Parallax Propeller chip the Tx and Rx lines output the correct strings and characters.


Could someone lend me a hand and tell me what I have initialized incorrectly.  I will really appreciate it