开发者

Writing to COM Port

I created an application to read information from a serial interface COM Port using MFC and the program now reads information from the COM Port, but I'm not sure what exactly its displaying. It is showing an arrow, that we usually get in a hyper terminal. If I need to write something onto the hyper terminal by some COMM commands(like creating handles, grouping them, displaying values etc) using my MFC Dialog Based Applic开发者_如何转开发ation, how may I do that?

Basically I have some commands that I use on my hyper terminal. For Ex:

-> $PPROCH,A,00000020,1,1*##<crlf> 
+>

.. The above command creates a handle A. Once the above command gets executed on the hyper terminal, the +> comes which shows that the information is added. This is done by hyper terminal. But I need to be able to do this via my MFC Dialog based program, where in the user can input the above command through a text box or something and the hyper terminal reads it and stores the handle created.Any way of doing this? Could anyone please suggest me a way to go about this?

Many thanks in advance.

Cheers.


This can get quite complicated if you need to avoid the comms from blocking the user interface.

This should be of help: http://www.codeguru.com/cpp/i-n/network/serialcommunications/article.php/c5425

Ultimately you need to write to the port with the text that the user entered, and then read it to get the '+>'.

Not really sure what you mean by storing the handles? If you need it to remember that 'A' was set, I'd recommend splitting up the command components into separate user interface elements and constructing the $PPROCH command from the elements. You can then easily store the details of the request that you have sent and flag it as complete when you read back '+>' from the port.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜