AdvancedHMI Software
General Category => Support Questions => Topic started by: sb on January 21, 2016, 05:16:25 PM
-
I am using version 3.99a of AdvancedHMI and I have a pilot light that toggles the bits of a DINT array on ControlLogix. It is able to display the status of all of the bits (0-31), but when writing to bit 31 of each DINT, I receive a message that says "WRITE FAILED! Input string was not in a correct format."
For instance, I can write to bits Output[0].0 through Output[0].30 or Output[1].0 through Output[1].30, but it fails to write to Output[1].31 and Output[1].31. I did a test and the same is true for bit 31 of a DINT (i.e. Output.31). Solution?
Thanks.
-
Try this
- In Solution Explorer, go to the AdvancedHMIDrivers project
- Open \AllenBradley\EthernetIPforCLXCom.vb
- Go to line 395 and look for this code:
If Requests(TransactionByte)(0).Response.Values.Count > numberOfElements Then
- Replace that line of code with this:
If (Requests(TransactionByte)(0).AbreviatedDataType = &HD3 Or (Requests(TransactionByte)(0).BitNumber >= 0 And Requests(TransactionByte)(0).BitNumber < 65)) Then
-
Thanks! That fix does allow bit 31 to be toggled ON and OFF. There is now a new issue where as long as the DINT value is 0, bit 0 can be toggled ON and OFF. But, if the DINT value is not 0, bit 0 cannot be toggled ON. However, it can be toggled OFF if it was already ON. Previously, this issue did not exist.
-
I think I found the error. Instead of:
If (Requests(TransactionByte)(0).AbreviatedDataType = &HD3 Or (Requests(TransactionByte)(0).BitNumber >= 0 And Requests(TransactionByte)(0).BitNumber < 65)) Then
Line 395 should be:
If (Requests(TransactionByte)(0).AbreviatedDataType = &HD3 Or (Requests(TransactionByte)(0).BitNumber > 0 And Requests(TransactionByte)(0).BitNumber < 65)) Then
Stepping through the logic, the value returned on Line 398 for bits 1 through 31 is "True" or "False". Bit 0 returns the value of the DINT (e.g. -2), which gets translated to a "True" when it returns to the MomentaryButton_MouseDown routine of the PilotLight.vb. Changing it from ">=" to ">" forces it to convert the value to bits when BitNumber = 0. Making this code change has fixed the errors.
-
I looked further into this and found the root of the problem.
- Go to line 812 in EthernetIPforCLXCom.vb
- Add an "=" to the line of code, so it becomes this:
If BitIndex >= 0 And BitIndex < BitsPerElement Then
-
I removed my "fix" and tried yours and it works! I think I'll go with your version. Not fully understanding how the code works, I was worried that I might have broken something else with my fix.
Thanks for your help!
-
The purpose of most of that code is to accommodate BOOL arrays which are kind of exception to all the rules. I haven't tested yet, but those changes may have adverse affects when reading BOOL arrays.