AdvancedHMI Software
General Category => Support Questions => Topic started by: DougLyons on August 25, 2016, 07:45:41 PM
-
I am using AHMI Version 3.99n which I believe is the latest. I started with adding a ModbusTCPCom driver to the form.
Then I added a DigitalPanelMeter and set its PLCAddress value to 40001. Then I added a MomentaryButton and set its PLCAddressClick to 40001.0.
When I run this program, clicking on the button makes no change to the value in 40001 when it is zero.
If I set it to 1, then clicking the button has no effect until it is released and then the value goes to zero. Using ModRSsim2 I can see the following debug information.
Original Value of zero at beginning:
Button Press: In=0000 And=FFFF Or=0001 Out=0000
Button Release: In=0000 And=FFFE Or=0000 Out=0000
Original Value of one at beginning:
Button Press: In=0001 And=FFFF Or=0001 Out=0001
Button Release: In=0001 And=FFFE Or=0000 Out=0000
It seems that in the case of the Button Press, the And value should be FFFE like it is in the Button Release.
Also, I noticed that if I delete the DigitalPanelMeter and run the program there is no polling or communications at all.
Nothing is sent to the server (ModRSsim2) at all when the button is pressed or released.
Thanks for any help that you can provide.
-
Button Press: In=0000 And=FFFF Or=0001 Out=0000
This doesn't quite look right to me. This is how I think the AND/OR logic should result:
0000 AND FFFF = 0000
0000 OR 0001 = 0001
Therefore
(0000 AND FFFF) OR (0001) = 0001
If I am interpreting the line "In=0000 AND=FFFF Or=0001 Out=0000" correctly, shouldn't Out=0001 ?
-
Per the Standard Modbus Manual PI-MBUS-300 Rev. J we have this on Page 66.
Result = ( Current Contents AND And_Mask ) OR ( Or_Mask AND Not(And_Mask) )
For example:
HEX Binary
Current Contents = 12 0001 0010
And_Mask = F2 1111 0010
Or_Mask = 25 0010 0101
Not(And_Mask) = 0D 0000 1101
Result = 17 0001 0111
In a short summary:
1) If the AND bit is Set, then the existing bit will not be touched.
2) if the AND bit is Not Set, then the output bit will be forced to the OR mask bit value.
Thanks. Doug Lyons
-
I totally got that incorrect. This will be fixed in version 3.99p
-
That's great. Thanks, Archie.
-
I appreciate you reporting that and pointing me to the solution.
-
Version 3.99p has been posted with the fix to this.
-
Archie,
I appreciate your efforts on this, but there is still a problem with the button press.
Here is what we had before as noted above:
Original Value of zero at beginning:
Button Press: In=0000 And=FFFF Or=0001 Out=0000
Button Release: In=0000 And=FFFE Or=0000 Out=0000
Here is what I see with the new version 3.99p:
Original Value of zero at beginning:
Button Press: In=0000 And=0000 Or=0001 Out=0001
Button Release: In=0001 And=FFFE Or=0000 Out=0000
This case does work as expected, but if I put FFFF Hex into the 40001 register here is what we get:
Original Value of FFFF at beginning:
Button Press: In=FFFF And=0000 Or=0001 Out=0001
Since our address was 40001.0 we only wanted to affect the low bit.
But here we have reset all of the other bits except the low bit.
What I would have expected is for the AND to be the same as in the Button Release and be FFFE.
This would have left all of the other bits alone and only affected the low bit.
Hopefully you can review and fix this.
Thanks,
Doug Lyons
-
I based my logic on this statement from the Modbus specification:
"Note that if the Or_Mask value is zero, the result is simply the logical ANDing of the current contents and And_Mask. If the And_Mask value is zero, the result is equal to the Or_Mask value."
Now that I re-read it a little more carefully, I see I misinterpreted the last sentence. I will try this again.
-
Try this patch to see if I got it right this time:
https://sourceforge.net/projects/advancedhmi/files/advancedhmi/3.5/Patches
- Download and extract the V399p patch file
- Copy the file to \AdvancedHMIDrivers\support (over write existing)
- Rebuild the solution
-
Archie,
I appreciate your persistence on this. How this works is not easily understood.
I have downloaded and installed your latest patch and all seems to be great now.
I will do a bit more testing later, but I think that you have conquered this problem.
Thanks,
Doug Lyons
-
It was actually quite easy once I got it straight in my head. My biggest problem was that I could not get out of my head the way the other protocols do it.