A Bit Stuck on Writing Multiple MODBUS Registers
-
Hi Craig, I've definitely got multiple writes selected in the data source.
I might have to re-visit the calculator / converter looking at that number. I was just sending it the raw hex value.
I'll give it a go. Thanks :)
-
Hey Dan
Did a quick tet for you. I believe it is correct checkout the snapshot I took from Wireshark:
Something to note about modbus is that sometime in manuals they will prefix the register number with the register type. Holding register is decimal 4. So when you see that on a manual you will just put offset 104 in mango. You will also see that some manual are 0 based and some are 1 based. So you might need to try 103 instead of 104.
Below is the settings I used for my point. I used decimal 166774
-
Ok, so I can understand using 166774 gives you 0x00028b76, basically just bit shifts the entire thing in. And that by using a holding register implicitly puts a 4 in the front so only 104 is needed... But if the manual states you need a control key into 8 and its 1's complement into register 9, shouldn't it be 0x8B768B76 = 2339801974 DEC?
Fox
-
OK, now my brain is really hurting, I'll turn on the i/o log and see what mine is outputting.
Just to clarify a little further, the MODBUS register I need to write to is on 'Page 16', the manual says to multiply 256 x Page then add the Offset, so in this case I'm on (256 x 16) + 8 = 4104
When reading off battery voltages and other engine diagnostics off this the formula seems to work.
I'll try again with the decimal.Cheers
-
-
Interestingly, when I write the hex values I get this pop up error..
Nothing written in the log during this time however :/
-
@dan
just curious why the 'Number of registers' is '0'? shouldn't be at least '1'? -
It's greyed out and disabled.
-
Hi Dan
Regarding the address, I think you are correct. Well since other address work you are correct. If 4104 is not working I would try 4103.
I think @MattFox is correct regarding the ones's compliment that needs to be written to address 9. I get a different number tho.
-
I think your answer is right here craig, something is amiss with how I did it, but looking at it now, I think we're all starting to break the back of it.
-
Hey Guys, thanks again for helping out. That's a big number. I'll give that one a go, I'll try it into 4104 and 4103.
Cheers
Dan -
Interestingly I get a timeout message if I try writing the whole decimal number to either data point register.
If I change back to a hex value it just comes up with the top blue error again.
-
although might actually currently be a timeout in the network, as it's on the top of a mountain in NZ. at the end of a Mimomax link :/
I do believe it's snowing up there currently.. -
Bugga, still same timeout message when network is responding better.
com.serotonin.modbus4j.exception.ModbusTransportException: java.net.SocketTimeoutException: connect timed out
If I interrogate a standard read point it works fine.
-
although might actually currently be a timeout in the network, as it's on the top of a mountain in NZ. at the end of a Mimomax link :/
I do believe it's snowing up there currently..@dan Sounds like I need to make a roadtrip! Haha
-
With a bloody big hammer.
-
Seems like perfect troubleshooting conditions :)
ye so basically no response from the command. Only thing I can suggest is checking if the actual number is causing the "no response" by sending a different digit. is the modbus request going over the network or do you have a local mango instance there ? -
Yeh the Mango instance is a few hundred ms away. It seems to work fine reading in voltages and RPM's and the like. Just been playing up a little today probably due to the weather.
Even when it was working fine the write function still didn't seem to be the correct syntax. -
If I was troubleshooting I would create data points instead of using the modbus tool. It looks like you are using quite an old version of mango and I have had issues with the modbus tool in older versions. I think it would be worth cancelling that out of the troubleshooting.
-
OK, thanks Craig. I have a data point I made earlier which I will go back to and see what it does.
Thanks