In this chapter we will show you an example of communication by the Modbus
Ethernet protocol (the PmModbusMr - Driver for communication by Modbus Master protocol
driver). However the procedure of configuring a functional communication is similar for any other PROMOTIC driver (e.g. the PmS7
- Into the PmRoot
object add a new PmFolder
object named "Communication".
Note: The PmFolder objects can be used in order to create logical structure of the application tree.
- In the upper portion of the following window select the communication type "Network TCP/IP communication".
- Enter the PLC network address
Keep other settings unchanged and confirm:
Compile all panels.
By the procedure described above, you have just added and configured the communication driver. The system created automaticaly communication objects PmComm and PmCommData with corresponding settings.
Following objects were also created:
- Data containing prepared variables with communication data extension.
- and graphic panel PanelData displaying values read from the device.
Note: Any modification made in the connected PmData object is automaticaly projected into this panel (current data is read automaticaly).
Now let's connect the variable "Temperature" to communication data. This setup is similar to setting variables trending by data extensions.:
- Select page Data
in object "BoilerPlant/Boiler1/Data".
- Select variable: "Temperature". Open configuration window of this variable (press Edit or doubleclick).
- Create new data extension by pressing the "Add" button and select: Data extension: ExtComm
- In the "Target object (PmCommData)
" configurator use the button marked with three fullstops and select the previously created PmCommData
object (the path to the object "/Communication/CommModbus/Comm/Data
- Open the "ItemID
" configurator by pressing the button marked with three fullstops. All steps mentioned above are common for all communication protocols.
- Then set the parameters specific only for Modbus and save the changes.
Compile all panels and launch the application into runtime. Click the "Panels" icon in the upper toolbar which opens a window listing all panels of the application. Select "Modbus - Received data" from the list.
You can use the INFO system
to monitor the status and quality of communication.
Additional communication options
In the previous cases you have always defined the address of the variable in the device from which the variable was read. This kind of communication is not suitable in some specific situations and some protocols do not even have such option available.
An example of such protocol may be represented by the general character/binary protocol PmChar, that allows the application designer to create a unique commnication protocol for devices with simple but non-standardized communication.
For this kind of low level communication the PmCommMsg communication object can be used. This object can be created only in the PmComm object. In the PmCommMsg object, it is possible to define the communication message, that will be sent into the corresponding device and the PmCommMsg object can also process the reply to such message.
More detailed information can be found in the PmCommMsg object documentation.