I've run into a problem recently where I am trying to write parameters for a run of a system into the PLC. When I'm writing actual numerical values everything works fine but I have some values that are Booleans. This is what I'm writing currently (and where I'm stuck):
For count As Integer = 0 To index
SegmentNumber = SegmentSetpoints(index, 1) 'if the segments are read out of order then use the segment # field to indicate placement
Label1.Text = "Segment " & count & " is being downloaded."
EthernetIPforMicro800Com1.Write("PROGRAMABLECONTROL.Segments[" & SegmentNumber & "].number", SegmentSetpoints(index, 1))
EthernetIPforMicro800Com1.Write("PROGRAMABLECONTROL.Segments[" & SegmentNumber & "].next", SegmentSetpoints(index, 2))
* EthernetIPforMicro800Com1.Write("PROGRAMABLECONTROL.Segments[" & SegmentNumber & "].loop", CInt(Int(SegmentSetpoints(index, 3).Equals("true"))))
EthernetIPforMicro800Com1.Write("PROGRAMABLECONTROL.Segments[" & SegmentNumber & "].durationSec", SegmentSetpoints(index, 4))
EthernetIPforMicro800Com1.Write("PROGRAMABLECONTROL.Segments[" & SegmentNumber & "].startTempSP", SegmentSetpoints(index, 5))
EthernetIPforMicro800Com1.Write("PROGRAMABLECONTROL.Segments[" & SegmentNumber & "].endTempSP", SegmentSetpoints(index, 6))
*EthernetIPforMicro800Com1.Write("PROGRAMABLECONTROL.Segments[" & SegmentNumber & "].ramp", CInt(Int(SegmentSetpoints(index, 7).Equals("true"))))
*EthernetIPforMicro800Com1.Write("PROGRAMABLECONTROL.Segments[" & SegmentNumber & "].soak", CInt(Int(SegmentSetpoints(index,
.Equals("true"))))
*EthernetIPforMicro800Com1.Write("PROGRAMABLECONTROL.Segments[" & SegmentNumber & "].lastSegment", CInt(Int(SegmentSetpoints(index, 9).Equals("true"))))
EthernetIPforMicro800Com1.Write("PROGRAMABLECONTROL.Segments[" & SegmentNumber & "].aquisitionInterval", SegmentSetpoints(index, 10))
EthernetIPforMicro800Com1.Write("PROGRAMABLECONTROL.Segments[" & SegmentNumber & "].TCHHalarmLevel", SegmentSetpoints(index, 11))
EthernetIPforMicro800Com1.Write("PROGRAMABLECONTROL.Segments[" & SegmentNumber & "].TCLHalarmLevel", SegmentSetpoints(index, 12))
EthernetIPforMicro800Com1.Write("PROGRAMABLECONTROL.Segments[" & SegmentNumber & "].TCHLalarmLevel", SegmentSetpoints(index, 13))
EthernetIPforMicro800Com1.Write("PROGRAMABLECONTROL.Segments[" & SegmentNumber & "].TCLLalarmLevel", SegmentSetpoints(index, 14))
EthernetIPforMicro800Com1.Write("PROGRAMABLECONTROL.Segments[" & SegmentNumber & "].RoomHHalarmLevel", SegmentSetpoints(index, 15))
EthernetIPforMicro800Com1.Write("PROGRAMABLECONTROL.Segments[" & SegmentNumber & "].RoomLHalarmLevel", SegmentSetpoints(index, 16))
EthernetIPforMicro800Com1.Write("PROGRAMABLECONTROL.Segments[" & SegmentNumber & "].RoomHLalarmLevel", SegmentSetpoints(index, 17))
EthernetIPforMicro800Com1.Write("PROGRAMABLECONTROL.Segments[" & SegmentNumber & "].RoomLLalarmLevel", SegmentSetpoints(index, 18))
Next
The asterisks are where my attempt is. I tried to convert the Boolean into an integer and write that but gives me an error: Object reference not set to an instance of an object.
Any advice for this would be great appreciated.