Author Topic: specify the bit address within the property PLCAddressClick  (Read 5522 times)

Godra

  • Hero Member
  • *****
  • Posts: 1447
    • View Profile
Re: specify the bit address within the property PLCAddressClick
« Reply #15 on: November 07, 2016, 10:55:03 AM »
The correct format should be: 414200.10.

The format that worked for me was: 40011.1 or 40011.14 ...

You shouldn't be using the WriteValue output type.

« Last Edit: November 07, 2016, 05:32:12 PM by Godra »

automatizzando

  • Newbie
  • *
  • Posts: 15
    • View Profile
Re: specify the bit address within the property PLCAddressClick
« Reply #16 on: November 07, 2016, 11:18:22 AM »
This format also works with read me.
But I just can not understand how to send a value to the property
"WriteValue"
When you select the WriteValue property, where you write the value to be sent?

Godra

  • Hero Member
  • *****
  • Posts: 1447
    • View Profile
Re: specify the bit address within the property PLCAddressClick
« Reply #17 on: November 07, 2016, 11:35:21 AM »
What value are you looking to write?

Because you are looking to change a bit, the only values that are accepted are either "0" or "1".

That is why you need to change the OutputType property of the PilotLight to either:

- MomentarySet (write "1" to the destination address temporarily)
- MomentaryReset (write "0" to the destination address temporarily)
- SetTrue (write "1" to the destination address)
- SetFalse (write "0" to the destination address)
- Toggle (switch between "0" and "1" with every click)

automatizzando

  • Newbie
  • *
  • Posts: 15
    • View Profile
Re: specify the bit address within the property PLCAddressClick
« Reply #18 on: November 07, 2016, 02:09:50 PM »
Hello, I would write the "weight" (value) of the bit.
For example, bit 1 = 1; bit 2=2; bit 3 = 4;  ........   bit 8 = 255 etc.
In this way we solve the problem.
I create many buttons (Pilotlight) for each bit to be set, without further complications.
I can do it with the clik event inserting the statement.
ModbusTCPCom1.Write ("address", value).
But I do not know if there is a suitable object properties.
Thanks for your patience
« Last Edit: November 07, 2016, 02:14:18 PM by automatizzando »

Archie

  • Administrator
  • Hero Member
  • *****
  • Posts: 5322
    • View Profile
    • AdvancedHMI
Re: specify the bit address within the property PLCAddressClick
« Reply #19 on: November 07, 2016, 02:52:36 PM »
The PilotLight does not support the ValueToWrite property in the current version, you would have to use the BasicButton.

I will make sure the next release implements the property in the PilotLight

Godra

  • Hero Member
  • *****
  • Posts: 1447
    • View Profile
Re: specify the bit address within the property PLCAddressClick
« Reply #20 on: November 07, 2016, 05:39:09 PM »
Just out of curiosity:

What "address" are you using in those statements: ModbusTCPCom1.Write ("address", value)?

The values that you want to write are not the actual bit values but integer values instead.

The address 414200.10 points to the bit level.

From my tests with MOD RSSim, even if I use a BasicButton, set its OutputType property to WriteValue and in the ValueToWrite property input any integer value greater than "0", it will still only write "1" to that address bit.

If you check the attached picture, all the buttons are set to WriteValue and the ValueToWrite is higher than "0" in each one of them (and goes as high as 14). Still, only the value of "1" was written to the bit. For reference, the "weight" of each bit is posted either above or below the button.

If I change the output type of all buttons to Toggle then I still get the same result but have a bit more control over changing the state of each bit.
« Last Edit: November 07, 2016, 11:41:10 PM by Godra »

automatizzando

  • Newbie
  • *
  • Posts: 15
    • View Profile
Re: specify the bit address within the property PLCAddressClick
« Reply #21 on: November 09, 2016, 03:07:58 PM »
Forgive the delay in reply.
Quote
Just out of curiosity:

What "address" are you using in those statements: ModbusTCPCom1.Write ("address", value)?

Code: [Select]
ModbusTCPCom1.Write ("6:14200", 1)
Bit1=true
Write: ModbusTCPCom1.Write ("6:14200", 2)
Bit2=true
Write: ModbusTCPCom1.Write ("6:14200", 4)
Bit3=true
ecc.
Sorry if my English is unclear
« Last Edit: November 09, 2016, 03:09:54 PM by automatizzando »

Godra

  • Hero Member
  • *****
  • Posts: 1447
    • View Profile
Re: specify the bit address within the property PLCAddressClick
« Reply #22 on: November 09, 2016, 08:21:54 PM »
With writes like those, you are actually setting all bits at the same time.

I will use your example:

Write: ModbusTCPCom1.Write ("6:14200", 4)
Bit3=true

It is not only that you are setting Bit3 to True, you are also setting all other bits to False.
This because value 4 in binary is 0000000000000100.

If the previous value was 0000000000100000, by writing 4 to the address then you would set the Bit6 to False and also set Bit3 to True.

If your PilotLights have bit level addresses and you want to be able to use the ValueToWrite property (if Archie provides that functionality in the next release of AHMI), then you might get different results than you expect.

What I am trying to suggest is that, for your PilotLights, the PLCAddressClick field might need to be set as 414200 (integer value) and PLCAddressValue field might need to be set as 414200.10 (bit value).
« Last Edit: November 10, 2016, 09:16:19 AM by Godra »

automatizzando

  • Newbie
  • *
  • Posts: 15
    • View Profile
Re: specify the bit address within the property PLCAddressClick
« Reply #23 on: November 10, 2016, 02:53:45 PM »
I understand what you mean.
I know what happens by writing the "weight" of a single bit in a word.
Having to "raise" a single bit at a time in the word, is good for me to proceed in this way.
Differently I first read the value of the word, and then I added or subtracted the weight of the bit to be written.
Code: [Select]



*Ready Word
Value_Ready=ModbusTCPCom1.Read ("4:14200")

*Set Word
value_Write=Value_ready+bit_value

*Write Word
ModbusTCPCom1.Write ("6:14200", value_Write)
« Last Edit: November 10, 2016, 02:57:44 PM by automatizzando »