How can i control my hcs08 mc through serial port?

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

How can i control my hcs08 mc through serial port?

3,505 次查看
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.
标签 (1)
0 项奖励
回复
3 回复数

1,094 次查看
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 项奖励
回复

1,094 次查看
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 项奖励
回复

1,094 次查看
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 项奖励
回复