Hello all
Last year i had to create a HMI program to read and write data from/to a DELTA PLC with modbus TCP and publish the values to a mosquitto broker that runs on Raspberry.
Other projects occupied my time so it was left behind. But now i must finish it. I want to show two problems i have. The might actually be my problems, since i'm not very good at python, but in .NET-))
Anyway, so far I managed to read and write most of the data types (coil/int/float). However, i have the following two problems:
1) When i write a float, the result is seen on the attached picture. On that picture you see that i write the number 2.12, but the result is 2.109375. This happens with all the floats.
The value 2.109375 is what my program have read from the PLC and published to the mosquitto (on the right of the picture it is a testing mqtt client program).
2) On the PLC there is a 32bit number that contain alarm bits. Bits start from 0 to 28. All these bits represent some conditions. If a bit is ON, we have an alarm.
I can read values up to 65535 (16bit only). I have played with the data_format but most of the times i get the error "struct.error: unpack requires a bytes object of length 4".
Or i get "struct.error: 'H' format requires 0 <= number <= 65535". How can i write 32bit integers?
Any ideas? I'm using version 0.5.7.