mc9s12dt256 serial comm issue

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

mc9s12dt256 serial comm issue

2,310件の閲覧回数
Franklin
Contributor I
Hi,
 
I am trying to control another device with my hcs12 microcontroller using the serial port. The command I wish to send to the other device is
 
"P BE 2"    followed by the return key
 
Using hyperterminal, I can send this command and the device responds as expected. However, when I programmed my hcs12 to send the following code,
 
            byte RequestMsg[9] = {'P',' ','B','E',' ','2','\r','\n',0};
 
using the SendBlock, the other device does not respond.  I have tried using only a carriage return, only a line feed, and various other ascii symbols, to no avail. When I send the block to hyperterminal, the output is predictably, "P BE 2" 
 
Any ideas about the source of my problem are greatly appreciated
ラベル(1)
0 件の賞賛
4 返答(返信)

503件の閲覧回数
nikosxan
Contributor I
Hello
 
First i think you should be sure that data goes to the device from you S12, so verify correct S12-Tx Device-Rx path at least, and Usually you DO need a null modem cable. Is there a way to verify data from S12 received by the device ? (for eg plot them to som kind of screen...). On last i would also analyse the behavior of car. return as understood by the device. Last but not least, exact match of comm settings....Does the device needs parity ???
0 件の賞賛

503件の閲覧回数
bigmac
Specialist III
Hello,
 
You say that Hyperterminal will successfully communicate with the remote device.  Assuming you are using a "straight-through" cable, and since Hyperterminal will be operating as a DTE (data terminal equipment), this would mean that the remote device is configured as DCE (data communications equipment).
 
You also say that the HCS12 board can successfully communicate with Hyperterminal, and this implies that the board is currently configured as DCE.  Unless you can change the board configuration to DTE, you will need to use a null modem (cross-over) cable.
 
Regards,
Mac
 
0 件の賞賛

503件の閲覧回数
Franklin
Contributor I
I was using the wrong cable. Thanks guys :smileyhappy: One of those knuckle-head mistakes, like trying forgetting to plug something in and wondering why it's not working... heh
0 件の賞賛

503件の閲覧回数
JimDon
Senior Contributor III
Are you sure that you don't need a null modem cable to connect the board to the device?

If the are both DTE's the this could be the case.
0 件の賞賛