Click here to Skip to main content
15,890,741 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I'm new to this form and don't normally program in C# I'm more SCADA/PLC/VB guy and could really use some help.
I'm currently working on an HMI panel running a Beijer iX application in WinCE 6, the app uses C# for its scripts.
My problem then,
I have to send a data string (using an RS232 port) to another computer (survey spread on a cable lay ship), the string needs to be made up from various tags from the HMI tag database.
I can access the COM port and send data out, but only from a screen button and I really need to setup a 1 second timer for this and so far I cannot work out how to build the string to send.

I have written this very program in VB a long time back but so far C# has got me stumped

Any help/pointers would be greatly appreciated

Thanks

Rab
Posted
Comments
[no name] 24-Mar-13 12:38pm    
See http://msdn.microsoft.com/en-us/library/system.timers.timer%28v=vs.71%29.aspx for help on timers. Not sure what your question is about strings..... look up the StringBuilder class, I guess.
RabMcFall 24-Mar-13 13:06pm    
Thanks for the help I'll let I'll post the code for others when done.

1 solution

The best way to achieve that is to use SerialPort[^] class, with its several methids, properties and events.

Example in C#: Serial Communication using C# and Whidbey[^]
Basic serial port listening application[^]

Example in VB.NET: http://msmvps.com/blogs/coad/archive/2005/03/23/SerialPort-_2800_RS_2D00_232-Serial-COM-Port_2900_-in-C_2300_-.NET.aspx[^]

To send/receive data in a period of time, use timer[^] class, example: How to use timer control in C#[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900