Internet PLC Forum
General => Technical support => Topic started by: dwkw on October 06, 2008, 07:59:02 PM
-
Hi,i am doing a project on a chinup trainer.i am using a photo sensor to capture the number of chinups into a channel.I am also using vb.net to communicate with plc and store the record in access.i would like to know in what format the data is recorded?And also is this code sufficient to store number of chinups in variable 'int'?
Public Class Form1
Private WithEvents serialPort As New IO.Ports.SerialPort("COM1")
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Try
serialPort.Open()
Dim int As String = ""
'Read the corresponding value and store
int = Me.serialPort.ReadLine()
serialPort.Close()
End Try
End Sub
-
What model of PLCs are you using? Which variable in the PLC do you want to access? To access the T100MD+ PLC, the command and response format are stated in Chapter 3 and 4 of the User's Manual.
-
So if i want to read from EEPROM,in my vb program i just have to connect to serial and send a host link command right?What is the response for?
I am using T100MD-1616+
-
Yes, you send a command such as "@01RXI00010400" which is to read EEPROM address 1 to 4. The response string contains the data you requested and you have to extract them from the response string using the VisualBasic MID command.
-
Is it something like this?
Public Class Form1
Dim int As String
Dim temp As String
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
SerialPort1.Open()
SerialPort1.Write("@nnRUnn00*")
int = SerialPort1.ReadLine()
temp = Mid$(int, 1, 4)
End Sub
End Class
-
Please follow examples provided in the following links:
http://www.tri-plc.com/applications/VBsample.htm