News:

Welcome on our forum!

Main Menu

MODBUS RTU to My SQL

Started by japras, January 09, 2019, 11:05:59 AM

Previous topic - Next topic

japras

hello,

i am new to this software. what i want to do is take data from my PLC using modbus RTU and to put it into SQL database.

I will highly appreciate if someone has managed to do this, to tell me how you managed to do it.

i am currently upto the stage where i have successfully managed to do a data query.
the response is as expected:
#01#03#0C#42#9A#00#00#42#A0#00#00#42#A4#00#00#C7#2A
first part: 01 = slave ID
second part: 03 = function code
third part: 0C = number of registers to read
fourth part: 42 9A 00 00 = value of register that i want = 77 decimal
fifth part: 42 A0 00 00 = 80 decimal

Note: my data type is 32 bit single floating point, with big endian format

my question is, what is next for me to do?
- i tried to get these data to go into excel first but so far the data that is outputted to excel is gibberish
- I am guessing my issue is with the parsing stage? because i guess that is the part that converts the hex to a decimal number?


much appreciated.

Arthur Grasin

Hello,

1. Address - it looks like offset. Please, try it.
2. Set Offset to -1. In this case, the program will calculate it automatically for sequential items.
3. Count - I think it should be "1".

Tutorial:
http://www.aggsoft.com/serial-data-logger/tutorials/modbus-polling-1.htm
If you like my work, please take a few seconds and add feedback about our site or our software [here]

japras

Hi Arthur!

thanks very much. i finally found the solution and it was exactly as you said. i ended up trying all offsets between -1 and 8 and finally found out the correct address.

thank you very much sir! you are amazing

japras

Hello Arthur, or other kind users,

i want to ask with this advanced serial data logger software:
- i have multiple machines that talk to a central modbus master, which is this advanced serial data logger
- right now if i have 2 devices for example with modbus ID 2 and modbus ID 3, i am able to get the data to parse just fine, using the same parsing variable name e.g. "ITEM1" but i am having issue with the ODBC module because it seems that i am unable to use the same "ITEM1"
- is it possible with the "modbusRTU" module, to set up multiple queries but then the data goes into the same variable name in the response items.

thank you .

Arthur Grasin

In your case, you should define separate request for each device and disable the "Export data for all requests at once" option.
If you like my work, please take a few seconds and add feedback about our site or our software [here]

japras

YOU ARE A GENIUS! THAT IMMEDIATELY MAKES IT WORK!
WOW YOU ARE TRULY LIFESAVER. I HAVE SPENT ALMOST 10 HOURS TRYING TO FIGURE THIS PROBLEM OUT. you solved it immediately. thank you very much, good sir!