Reputation: 1
When i try to read some value appear de error on image... I already tried diferent ways and the result it´s all time the same(comment lines). How i can read a value in vb.net and s7.1200? thanks
Option Strict Off
Option Explicit On
Imports S7.Net
Imports System.Data.SqlClient
Imports Microsoft.Reporting.WinForms
Imports System.Data
Imports VB = Microsoft.VisualBasic
Imports Microsoft.VisualBasic.PowerPacks
Imports System.Xml
Imports System.Text
Imports System.IO
Imports System.Security.Cryptography
Imports System.Threading
Module PLC_InOut
Public Sub PLCInOuts()
' Dim Result As BitArray()
' Result = PLC.Read("DB8.DBW0")
'\\\\\\\\\\\\\\Inputs
' Result = PLC.Read(DataType.DataBlock, 8, 0, VarType.Bit, 0, 16)
'Result = PLC.Read(DataType.DataBlock, 8, 0, VarType.Byte, 1, 0)
' Result = PLC.Read("DB7.DBX0.0")
'Dim Value1 As Byte = PLC.Read("DB8.DBW0")
Dim u1 As System.UInt16 = PLC.Read("DB8.DBW0")
Dim b1() As Byte = BitConverter.GetBytes(u1)
If test1_out Then
' PLC.Write(DataType.Output, 0, 0, VarType.Bit, True)
'PLC.Write("O0.0", 1)
'PLC.Write("%M47.6", True)
' PLC.Write("DB7.DBX0.0", True)
'PLC.WriteBit(DataType.DataBlock, 7, 0, 0, True)
End If
' ("db8.dbx0.0")
'\\\\\\\\\\\\\\outputs
' PLC.WriteBit(DataType.DataBlock, 7, 0, 0, test1_out)
End Sub
End Module
Upvotes: -1
Views: 302
Reputation: 1
The problem was the plc hardware was not completely downloaded after changed the plc proprieties-protection & security parameters
Upvotes: 0