Sample Serial Communication Program with PLC
The above sample program is created using Visual Basic 6.0 that supports the MSComm controls. An alternative example is also created using Visual Basic 2008 Express (free download from Microsoft website) which uses the .NET frame to support the Serial I/O object.
This program lets you define the serial port, baud rate and comm format. It will then take your command string and send it to the PLC and obtain a response string from the PLC and display on the response box. It takes care of time-out (user- definable) and will not block the program if the PLC is not present. We have tested it on a H-series as well as M-series PLC and it works well. Please feel free to email to email@example.com if you have any feedback or suggestions.
You can easily include this form into your project and display it for user to set the communication parameters as well as perform some quick test of the communication with the PLC. The full source code is provided for your convenience if you wish to make any modifications. There are a 3 public functions defined in this sample file which you can call from your own application programs directly:
|2. Bruce Scow of Shanghai Contributed
the following DLL for connecting to TLServer
|3. Julian Stone of The
United Kingdom Contributed the following application notes:
|4. Fran Jarnjak of USA Contributed the
following application notes: