Page 1 of 1

issue reading Process Image byte variables

Posted: 28 Jun 2021, 05:39
by livesource
Hi,

I am having an issue reading any of the Process Image byte variables ... ie. DIn_Status, DOut_Status, RevPiLED all return 00000000 regardless of the actual state.

Example

Code: Select all

piTest -w DOutBit_1,1 
Success - Activates OUT 0 LED on the unit

Code: Select all

piTest -1 -q -r DOutBit_1
Success - Returns "1"

Code: Select all

piTest -1 -q -r DOut_Status,b
Fail - Returns "00000000"
I Expected - "10000000" from this. Have I got something wrong here? How can I read all the DOut_x bits in one piTest command?

I posted about this last week here viewtopic.php?f=6&t=2884#p10472, but still haven't got a response. I'm really hoping someone can help me here as I've got quite a tight deadline to get this project working. I've also just plugged in a ModBus slave and am having a similar issue with that... I can read BOOL variables ie Input_Bit_1 = 1 but not WORD variables ie Input_Word_1 = 00000000 00000000.


Thanks for any suggestions!

Re: issue reading Process Image byte variables

Posted: 28 Jun 2021, 08:19
by livesource
Additional issue: Modbus_Actions_Status errors not resetting

The example below is for an action configured as follows

Action #2 | 95 | READ_HOLDING_REGISTERS | 40004 |1 | 1000 | Input_Word_7


1.

Code: Select all

piTest -q -r Modbus_Action_Status_2
This returns "2"
I understand 2 = ILLEGAL DATA ADDRESS

2.
I now want to reset the error code on Modbus_Action_Status_2 so that I can try a different address and check if the error is reported again.
I remove Action 2 from the Extended Data GUI so that the error is not regenerated while poling, then...

Code: Select all

piTest -w Action_Status_Reset_2,1
This returns "Set bit 1 on byte at offset 207. Value 1"

3.

Code: Select all

piTest -q -r Modbus_Action_Status_2
This still returns "2"
I expected this would be 0

Modbus_Master_Status is 0 the whole time. The variable Input_Word_7 is also 0 the whole time. I am able to read the addresses 40004 the slave fine using a gui on my PC and it returns 5. I was also able to read 40004 using minimalmodbus on the revPi, but I had to use "Raw Address" "3" rather than 40004. I'm not sure if this Raw Addressing is common or something particular to the monnit gateway I am working with.

Re: issue reading Process Image byte variables

Posted: 28 Jun 2021, 09:13
by nicolaiB
Hi
livesource wrote: 28 Jun 2021, 05:39

Code: Select all

piTest -1 -q -r DOut_Status,b
Fail - Returns "00000000"
I Expected - "10000000" from this. Have I got something wrong here? How can I read all the DOut_x bits in one piTest command?
Why do you expect a different value than 0? Extract from the wiki:

Code: Select all

DOut_Status: if this byte has a value not equal to zero, the digital outputs were cutout due to emergency. Bit 5 indicates overheating (150 °C). As soon as the error state is over, DOut_Status goes back to zero. D

Re: issue reading Process Image byte variables

Posted: 28 Jun 2021, 09:19
by nicolaiB
Hi,

please remove any register configuration and restart the modbus driver / reset the action. Is it still != 0?

Regarding the raw address: I have a Modbus RTU meter connected to my RevPi and having the same issue that the register address is specified with 30007, but I have to use 7 in order to get data. Ihmo this comes from the original Modbus specs which where written with Modicon controllers in mind where the function code was encoded in the address.

Nicolai

Re: issue reading Process Image byte variables

Posted: 29 Jun 2021, 11:38
by saardrimer
I think that some of the issues I've been experiencing are related:

viewtopic.php?f=6&t=2905

Could there be something about Modbus registers with 5 digits being mishandled somehow?

It would be great to know what is causing this issue and if it's a piTest issue or something else.