In this post I'd like to share how to connect PLC omron with VB via converter serial to ethernet in this case I use MOXA, please make Vb interface below:
Write the source code below:
Private Sub Command1_Click()
Text1.Text = “”
cmd$ = “@00WR0001FFFF”
Call Checksum(cmd$, cksm$)
command.Text = cmd$ + cksm$ + “*” + Chr$(13)
Winsock1.RemoteHost = “192.168.1.100″
Winsock1.RemotePort = 2101
Winsock1.SendData command.Text
Private Sub Command2_Click()
Text1.Text = “”
cmd$ = “@00WR00010000″
Call Checksum(cmd$, cksm$)
command.Text = cmd$ + cksm$ + “*” + Chr$(13)
Winsock1.RemoteHost = “192.168.1.100″
Winsock1.RemotePort = 2101
Write the source code below:
Private Sub Command1_Click()
Text1.Text = “”
cmd$ = “@00WR0001FFFF”
Call Checksum(cmd$, cksm$)
command.Text = cmd$ + cksm$ + “*” + Chr$(13)
Winsock1.RemoteHost = “192.168.1.100″
Winsock1.RemotePort = 2101
Winsock1.SendData command.Text
Private Sub Command2_Click()
Text1.Text = “”
cmd$ = “@00WR00010000″
Call Checksum(cmd$, cksm$)
command.Text = cmd$ + cksm$ + “*” + Chr$(13)
Winsock1.RemoteHost = “192.168.1.100″
Winsock1.RemotePort = 2101
No comments:
Post a Comment