How can i control my hcs08 mc through serial port?

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

How can i control my hcs08 mc through serial port?

2,853 Views
girishrevadigar
Contributor I
Hi,
    I am a student,  newer to the hcs08 mc,  can anyone please let me know how can i controll the hcs08 mc through serial port?
       i mean i actuall ywant to send som commands to the mc to controll the switches etc.Pleas give me any reference materials if u know..or from where i can get the info about this?
.
 
Thanks ,
 
Girish.
Labels (1)
0 Kudos
3 Replies

442 Views
McGillMike
Contributor I
Actually, the main thing you would need to do, unless I misunderstood your question, is to simply configure receive and transmit interruptability of your process (in your case receive should be enough).
 
tha way, everytime a character is sent (providing you've properly configured the CLK source and divisors to get a matching baud rate on both ends), an interrupt is raised. Then you can store that character from the RECEIVE buffer into a temporary variable, et a flag such as charReceiveed = TRUE and simply deal with it however you please in the main loop.
 
All that is throughly explained in the datasheets with all the interrupt vectors and associated registers.
 
Another thing you should consider is holding a character buffer to store incoming charaters in the event they arrive faster then the system can service them (unlikely if it's just a matter of manual inputs, but of concern if you've got automated responses through internet of C socket code running on your PC). 
0 Kudos

442 Views
UcTechnoGeek
Contributor II
Attached is some code I have used based on using Processor Expert to create the serial port hardware driver.
 
What it does:
CmdProc.c - reads characters from the serial port and echos them back to the terminal.  When enter is pressed (or one of a few other stop conditions), the command is processed by matching the characters entered to a command list.  If a match is found, that routine is called from the main file (in this case EPT_vMR32.c).
 
I've cut most of the code out of the main file for clairity, so hopefully you can understand by the comments what is happening there.
 
Good luck.
 
uCTechnoGeek

Message Edited by UcTechnoGeek on 2007-03-2004:40 PM

0 Kudos

442 Views
eckhard
Contributor V
Hello,

maybe this can be useful for you :

http://www.eckhard-gosch.de/controller/ZwobLCD.zip.

it is for the HC08 not for the HCS08 but it should work.
The HCS08 SCI should be backward compatible to the HC08 SCI and you can taylor the command dispathcer in the main routine to your needs.


Eckhard
0 Kudos