B&R Introduction of MODBUS communication function block
author: PLC-SUPPLY
2022-12-23
Open the help file of B&R, search for DRV_MBUS, you can find the DRV_MBUS library.
In the figure above, you can see the functional blocks related to MODBUS communication, there are 4 functional blocks related to the master station, and 3 functional blocks related to the slave station. B&R mainly uses the following function blocks as the master station.
a. MBMOPEN()
The MBMOPEN() function block opens (activates) the master communication interface. The parameters are as follows
I/O parameter Meaning
I enable function block enable
I PDEVICE Name of the communication interface
I PMODE Communication interface parameter setting
The name of the IPCONFIG data block
I timeout communication timeout parameter
I ascii MODBUS mode, (0=RTU/1=ASCII)
O status error code, 0 means no error
O IDENT The handle provided to MBMaster(), MBMCmd(), MBMClose()
b. MB Master()
I/O parameter Meaning
I enable function block enable
I ident Handle pointer returned from MBMOpen()
O status error code, 0 means no error
O execute Whether to execute the command
O recordnum The number of current data exchange
c.MBMCmd()
I/O parameter Meaning
I enable function block enable
I ident Handle pointer returned from MBMOpen()
I mfc Modbus function code
I node Slave station number, 0 is broadcast
I data Data area first address
I offset offset
I len data length
O status error code, 0 means no error
d. MBMClose()
Close the communication interface of the master station
I/O parameter Meaning I enable Function block enable I ident Handle pointer returned from MBMOpen() O status Error code, 0 means no error
In the figure above, you can see the functional blocks related to MODBUS communication, there are 4 functional blocks related to the master station, and 3 functional blocks related to the slave station. B&R mainly uses the following function blocks as the master station.
a. MBMOPEN()
The MBMOPEN() function block opens (activates) the master communication interface. The parameters are as follows
I/O parameter Meaning
I enable function block enable
I PDEVICE Name of the communication interface
I PMODE Communication interface parameter setting
The name of the IPCONFIG data block
I timeout communication timeout parameter
I ascii MODBUS mode, (0=RTU/1=ASCII)
O status error code, 0 means no error
O IDENT The handle provided to MBMaster(), MBMCmd(), MBMClose()
b. MB Master()
I/O parameter Meaning
I enable function block enable
I ident Handle pointer returned from MBMOpen()
O status error code, 0 means no error
O execute Whether to execute the command
O recordnum The number of current data exchange
c.MBMCmd()
I/O parameter Meaning
I enable function block enable
I ident Handle pointer returned from MBMOpen()
I mfc Modbus function code
I node Slave station number, 0 is broadcast
I data Data area first address
I offset offset
I len data length
O status error code, 0 means no error
d. MBMClose()
Close the communication interface of the master station
I/O parameter Meaning I enable Function block enable I ident Handle pointer returned from MBMOpen() O status Error code, 0 means no error
Related News
About the classification, application and development of PLC 2024-01-02 416
There is a problem with PLC, how to quickly find the cause? 2024-01-02 349
How many communication methods does Siemens PLC have? 2023-08-03 800
Siemens PLC S7-300 has communication failure and remote maintenance method 2023-08-03 3596
What are the series and characteristics of Siemens PLC 2023-08-03 800
Summary of Siemens PLC selection method 2 2023-08-03 383
Summary of Siemens PLC selection method 1 2023-08-03 414
What Applications Would You Use PLCs? - Exploring the Widespread Use of Programmable Logic Controllers 2023-05-31 533
Is PLC Used in Robotics? - Understanding the Role of PLCs in Robotics 2023-05-31 507
Is PLC Programming Hard? - A Comprehensive Guide to PLC Programming 2023-05-31 707
What is a PLC in Business? 2023-05-27 509
What is a PLC Used For? 2023-05-26 587
What is a Ladder Diagram in PLC? 2023-05-25 614
Why Doesn't Smart Switch Work on My PLC? 2023-05-24 534
Why are PLC Installed Inside an Enclosure? 2023-05-23 530
Why Are Logical Racks Used in PLC? 2023-05-22 535
Why There is a Need of PLC in Industry 2023-05-20 556
Why the PLC is Important 2023-05-19 509
Why Some PLC Use Only the Basic Additions 2023-05-18 533
Why Scaling is Done in PLC 2023-05-17 496