Internet PLC Forum
General => Technical support => Topic started by: keith on October 05, 2009, 06:23:31 AM
-
Hope somebody can help me with a little serial communication problem I?m having. I wrote a simple front end to a touchscreen application in Visual Basic 2008 for interface with T100MD. Works great but now I?m trying to send the T100MD a control code in the form of simple Ascii string through the PC?s com port, per the following:
SerialPort1.Open()
SerialPort1.WriteLine(TextBox1.Text)
No difficulty getting the data out to the device ? as verified with my terminal program. My problem is that in order to correctly impement the instructions, the 888 requires a carriage return as part of the host-link command terminator. I cannot find any T100MD setting or Visual Basic reference that will add the CR after the string and I know I?m not the first to run into this. Any help that could be given would be very much appreciated.
Thanks
-
You may like to download the Visual Basic Express 2008 samples and see how the working code control the serial port:
http://www.tri-plc.com/applications/VBsample.htm#VB6sample
In fact you can simply add the sample object to your program which makes a very nice serial setup interface that is ready to go.
-
In Vb did you tried constant keyword 'vbCr' or Chr$(13)? Im not sure in the TM but Chr(13) should work in the TM100MD.
check the ascii table here http://www.asciitable.com/ and tri the function CHR(decimal index from the table)
Hope this works,
Ed
-
Sorry forgot sample
in VB:
Dim x As String
x = "Hello" & VbCr
or
x = "Hello" & Chr$(13)
In TM100:
A$ = "Hello" + Chr(13)
-
;D
Edgar was right on the money! Adding the vbCr makes host link commands simple to transmit and quite reliable. Thanks to you Edgar.