发表于:2005/5/31 21:53:00
#0楼
我用VB编上位机与PLC之间的通信模块,用的是RS232串口,但是向PLC写数据时好像就是写不到PLC的DM区中,为什么呢?哪位帮我看看!下面是向PLC写数据的子程序,我是假使向DM0000中写入0001,但是我再读DM0000,它里面的内容还是原来的值,不知道是不是哪里错了,请教各位了!
Private Function send()
Dim Outstring As String '¶¨Òå±äÁ¿
Dim readata As String
Dim cmd As String
cmd = "0001"
readata = "@00WD0000" & cmd
readata = readata & FCS(readata) & "*" & Chr$(13)
Outstring = readata
Text3.Text = Outstring
MSComm1.Output = Outstring
End Function
Private Function send()
Dim Outstring As String '¶¨Òå±äÁ¿
Dim readata As String
Dim cmd As String
cmd = "0001"
readata = "@00WD0000" & cmd
readata = readata & FCS(readata) & "*" & Chr$(13)
Outstring = readata
Text3.Text = Outstring
MSComm1.Output = Outstring
End Function