Author Topic: Writing Bools or Boolarrays using EthernetIPforMicro800com1.Write  (Read 1044 times)

aduhaime2003

  • Newbie
  • *
  • Posts: 36
    • View Profile
I have been trying to figure this out for a while now and it is slowing down progress on my project. Is it possible to use the EthernetIPforMicro800com1.Write command to write Bools and Boolarrays to a PLC? I tried translating the bits into binary integers but that did not work unfortunately 

FuzyDragon

  • Newbie
  • *
  • Posts: 19
    • View Profile
Re: Writing Bools or Boolarrays using EthernetIPforMicro800com1.Write
« Reply #1 on: December 09, 2015, 12:38:57 PM »
I have been curious about this as well. I've been trying to write booleans to a PLC but I keep getting an error that and index is overflowing. I can only assume it is from not properly writing the boolean in the first place. How would someone go about doing this?

aduhaime2003

  • Newbie
  • *
  • Posts: 36
    • View Profile
Re: Writing Bools or Boolarrays using EthernetIPforMicro800com1.Write
« Reply #2 on: December 10, 2015, 02:14:32 PM »
I need some serious help with this. Here is the code I'm using to try and write the Bool to the PLC:

  EthernetIPforMicro800Com1.Write("PROGRAMABLECONTROL.Segments[" & SegmentNumber.ToString & "].loop", CInt(SegmentSetpoints(index, 3).Equals("TRUE")))

The .loop address is my bit that I need to change and the rest is converting the integer value I have in the array into an equivalent Boolean value. However when I run the code i get this error:

Quote
An unhandled exception of type 'System.NullReferenceException' occurred in AdvancedHMI.exe

Additional information: Object reference not set to an instance of an object
.

What am I doing wrong here?

Any help would be appreciated


rbelknap

  • Jr. Member
  • **
  • Posts: 68
    • View Profile
Re: Writing Bools or Boolarrays using EthernetIPforMicro800com1.Write
« Reply #3 on: December 11, 2015, 07:42:46 AM »
Normally you get this error when something you are trying to use has not been initialized with the new keyword.

Try putting a breakpoint on the line(F9) and when it breaks you can use the mouse to hover over the different parts of the statement to see if one of the variables comes back as not having been initialized.
This should give you a direction to go in.

If hovering doesn't work you can highlight the variable names and hit Shift-F9 to get the values.