Modbus RTU and TCP/IP

This is the main technical forum for discussing problems that were encountered by users while developing PROMOTIC applications, and their possible solutions.

Modbus RTU and TCP/IP

Postby steven » Tue 15. Aug 2017 10:14:40

Hi everyone,
I am quite new to PROMOTIC and i would like to create a setting page for modbus RTU and TCP/IP.
So right now i would like to ask if is there anyway I can change serial port (COM1, COM2,etc), IP address and port while the application is running?
If there is, could anyone help/guide me through.
Thank you in advance.

Regards,
Steven
steven
 
Posts: 3
Joined: Tue 15. Aug 2017 10:01:58

Re: Modbus RTU and TCP/IP

Postby admin » Fri 18. Aug 2017 8:29:07

Hello,

There are basically two possible solutions:

1) The PmComm object (responsible for communications https://www.promotic.eu/en/pmdoc/Object ... maComm.htm) has methods OpenPort and ClosePort. You can use these methods to modify the ports and IP addresses.
See:
https://www.promotic.eu/en/pmdoc/Object ... enPort.htm
https://www.promotic.eu/en/pmdoc/Object ... sePort.htm

2) You can insert multiple PmComm objects into your application, each of these objects configured to communicate on specific ports or to specific IP addresses. Then you just activate the PmComm object you need to communicate with. This approach has the advantage that the data you read from individual devices (from various ports and IP addresses) are easily separated and storeand do not mix together.
admin
Administrátor
 
Posts: 70
Joined: Wed 12. Dec 2012 15:43:09

Re: Modbus RTU and TCP/IP

Postby steven » Sun 20. Aug 2017 7:48:02

Thank you for replying.
The alternative seems like a good method so i will try that. but for learning purpose i would still like to try the first method.
i have read about OpenPort and ClosePort but i dont seem to get the picture.
Is the method implement like this? (attach photo)

or am i totally off from the correct way of using it.
Attachments
openport.png
openport.png (39.36 KiB) Viewed 19324 times
steven
 
Posts: 3
Joined: Tue 15. Aug 2017 10:01:58

Re: Modbus RTU and TCP/IP

Postby admin » Wed 23. Aug 2017 12:39:04

Hello, could you please send me your PROMOTIC SCADA software project by e-mail to: kubny@microsys.cz so we can add example to it?
admin
Administrátor
 
Posts: 70
Joined: Wed 12. Dec 2012 15:43:09

Re: Modbus RTU and TCP/IP

Postby steven » Thu 24. Aug 2017 2:46:34

i have send you the file.
Feel free to edit anything inside and again thanks for helping.
steven
 
Posts: 3
Joined: Tue 15. Aug 2017 10:01:58


Return to I don't know how to...

Who is online

Users browsing this forum: No registered users and 3 guests

cron