Author Topic: Modbus TCP bit of word read/write 3.99yBeta33  (Read 971 times)

g.mccormick

  • Newbie
  • *
  • Posts: 29
    • View Profile
Modbus TCP bit of word read/write 3.99yBeta33
« on: July 02, 2019, 10:32:17 AM »
Its very likely that I am screwing up something.

I have a few 16bit bitmaps setup for hmi read and hmi writes in the PLC. 
I am attempting to use the basic button as well as the basic indicators.
Using the basic indicator, I can get bit 0 to indicate on/off by using plc address 40101.0.  I cannot seem to get the 40101.0 (or any other bit) to be set on/off using the click for either the button or the indicator.  Any help?

The end result is I will be using many different bits of several different words to both control and display different statuses.
Thanks

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5266
    • View Profile
    • AdvancedHMI
Re: Modbus TCP bit of word read/write 3.99yBeta33
« Reply #1 on: July 02, 2019, 02:54:33 PM »
In order to write bits within a word your device must support function 22 (masked bit write).

A work around could be to set OutputType to WriteValue and set ValueToWrite to the bit value (1,2,4,8,16, etc). With this method your PLC will need to turn off the bit and any button will set its bit and clear all others.

You could also write the values using code by reading the value, setting the bit, then writing the value back. There is the risk that a bit could change value in between the read and write making the write put that bit back to the previous value.

g.mccormick

  • Newbie
  • *
  • Posts: 29
    • View Profile
Re: Modbus TCP bit of word read/write 3.99yBeta33
« Reply #2 on: July 02, 2019, 08:24:43 PM »
Oh geeze.  I hadn't even given it a thought as to data handling with writing bit of word...  dumb me.  Thanks Archie.




On another note, I am passing a lot of floating point values to the HMI, and I am having to do some data manipulations in the plc to map the values to my 16bit int arrays that I have created for to/from HMI data. 

I am starting to think that perhaps full 32bit floating value are really not needed in the HMI data since I always set the value format to 0.0 for 1 decimal anyway.  So, my thought is to just map the floating point values in the PLC to value*10, then use the scale in the HMI data parameter to get to 1 decimal.  Do people normally just deal with floats, or do you all use ints with implied decimals?  Using ints*10 will use 1/2half as much read/write data.