Forum > Beginners

Lazarus IDE-Modbus Communication (Energy Analyzer, PascalSCADA)

<< < (2/4) > >>

avra:

--- Quote from: sentago on December 06, 2021, 11:54:05 am ---Even though I am connected to the analyzer, the Label always shows 0. What is the reason of this? Could it be due to the version of the Lazarus IDE?
--- End quote ---
How do you know that you are really connected to the analyzer? Having physical connection isn't enough. You need to check connection with some external application. Manufacturer offer software "Log Reader Program", but when you know relevent MODBUS registers and comm parameters - there are others like https://www.modbustools.com, https://www.modbusdriver.com/modpoll.html and https://bitbucket.org/heXor/openmodbustool/src/master/ (test server). First step would be to test connection from your pc using some MODBUS client application, and see if you get expected data from the device using some already working app. Then second step would be to test connection from your app to some MODBUS server application that would simulate your device MODBUS registers and where you can monitor if data you are sending with your Lazarus application is showing in the relevant registers on MODBUSserver. Even more advanced usage would be to use Wireshark for spying MODBUS messages, but that is not really needed. You can even skip PascalSCADA and directly use simple MODBUS lib as https://sourceforge.net/projects/mbutils/files/, https://github.com/coassoftwaresystems/delphi-modbus or already mentioned openmodbustool.

Manufacturer seams to have different MODBUS register tables for older and newer firmware. Are you using the correct one?

You might also face register naming confusion (start with 0 or 1, 30001 or 0000...), if you do not know enough about MODBUS it self:
https://support.industry.siemens.com/tf/ww/en/posts/modbus-registers-address-confusion/223613/
https://electronics.stackexchange.com/questions/505189/modbus-register-address-vs-register-number-absolute-address-vs-offset

You should follow this tutorial (TSerialPortDriver is not for TCP - if you have Ethernet option installed on your device):
https://www.pascalscada.com/modbus-rtu-and-tcp/

sentago:

--- Quote from: avra on December 06, 2021, 02:06:23 pm ---
--- Quote from: sentago on December 06, 2021, 11:54:05 am ---Even though I am connected to the analyzer, the Label always shows 0. What is the reason of this? Could it be due to the version of the Lazarus IDE?
--- End quote ---
How do you know that you are really connected to the analyzer? Having physical connection isn't enough. You need to check connection with some external application. Manufacturer offer software "Log Reader Program", but when you know relevent MODBUS registers and comm parameters - there are others like https://www.modbustools.com, https://www.modbusdriver.com/modpoll.html and https://bitbucket.org/heXor/openmodbustool/src/master/ (test server). First step would be to test connection from your pc using some MODBUS client application, and see if you get expected data from the device using some already working app. Then second step would be to test connection from your app to some MODBUS server application that would simulate your device MODBUS registers and where you can monitor if data you are sending with your Lazarus application is showing in the relevant registers on MODBUSserver. Even more advanced usage would be to use Wireshark for spying MODBUS messages, but that is not really needed. You can even skip PascalSCADA and directly use simple MODBUS lib as https://sourceforge.net/projects/mbutils/files/, https://github.com/coassoftwaresystems/delphi-modbus or already mentioned openmodbustool.

Manufacturer seams to have different MODBUS register tables for older and newer firmware. Are you using the correct one?

You might also face register naming confusion (start with 0 or 1, 30001 or 0000...), if you do not know enough about MODBUS it self:
https://support.industry.siemens.com/tf/ww/en/posts/modbus-registers-address-confusion/223613/
https://electronics.stackexchange.com/questions/505189/modbus-register-address-vs-register-number-absolute-address-vs-offset

You should follow this tutorial (TSerialPortDriver is not for TCP - if you have Ethernet option installed on your device):
https://www.pascalscada.com/modbus-rtu-and-tcp/

--- End quote ---

Hi avra,

Thank you for your answer.

I'll look into these and test again. I will post the results right here. The analyzer also has an ethernet port. I will test with TCP/IP as well.

sentago:
Hello again everyone

Yesterday I tried the Lazarus IDE with TCP/IP. I took a video about it and uploaded it. Where am I doing wrong?

https://youtu.be/FRWKIlOxYgM

DonAlfredo:
I would advice you to set:
PLCStation := 1;
MemAddress := 400001;

sentago:

--- Quote from: DonAlfredo on December 07, 2021, 08:11:04 am ---I would advice you to set:
PLCStation := 1;
MemAddress := 400001;

--- End quote ---

This time, the values sent and received on the simulation also change, but the label part still shows the value 0 in the Lazarum Form window.  :(

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version