libplctag / libplctag.NET

A .NET wrapper for libplctag.
https://libplctag.github.io/
Mozilla Public License 2.0
194 stars 50 forks source link

BoolPlcMapper not returning properly #339

Closed BMac099 closed 1 year ago

BMac099 commented 1 year ago

Can't get bool to work, always returns False, other types (DINT SINT INT STRING) all work fine.

Private Sub AGVPhotoEyeState()

    Try
        Dim myTag = New Tag(Of BoolPlcMapper, Boolean)() With

{ .Name = "PROGRAM:Robot_1_Plant_AGV.AGV.R12.AGV_Detection_PE", .Gateway = "10.1.192.18", .PlcType = PlcType.ControlLogix, .Protocol = Protocol.ab_eip, .Path = "1,0", .Timeout = TimeSpan.FromMilliseconds(5000) } myTag.Initialize() myTag.Read() Pe_state = myTag.Value Panel1.Invalidate()

        Debug.WriteLine("AGV PE State = " & Pe_state)

    Catch ex As Exception

        Debug.WriteLine("Exeption in AGVPhotoEyeState, " & ex.Message)
    End Try

End Sub
timyhac commented 1 year ago

Hi @BMac099 - there is some discourse on this subject here that may help: https://github.com/libplctag/libplctag.NET/issues/178

If the provided mappers don't do what you need, you can always create your own.