Configuring the Inovance Modbus-RTU Master Station

In the Inovance Inoproshop software, configure the RS485 master station for the AM500 series PLC (using Modbus RTU as an example). Inoproshop is developed based on Codesys, and its configuration method is more standardized and graphical.

Below are the detailed steps:

Part One: Hardware Connection (Same as AutoShop)

Confirm the port: The RS485 port on the AM500 PLC body (usually PORT 2 / COM2, DB9 female connector).

Pin definitions: Always refer to the hardware manual; common definitions are as follows:

PIN 3: RS485+ (Data+ or B)

PIN 8: RS485- (Data- or A)

PIN 5: GND (Signal Ground)

Wiring:

PLC (RS485+) -> All slaves (RS485+)

PLC (RS485-) -> All slaves (RS485-)

PLC (GND) -> All slaves (GND) (Important for common grounding)

Termination resistors: Connect 120Ω termination resistors at the ends of the bus (first and last devices).

Part Two: Software Configuration (Inoproshop)

Step 1: Add Device and Set Serial Port

Open/Create Project: Open your AM500 project in Inoproshop.

Open Device Tree: In the left Device view, expand your PLC device.

Configure Serial Port:

Find the device representing the RS485 port, usually COM2 or Serial.

Double-click it to open the configuration properties window.

Set Port Parameters:

Operating Mode: Select “Modbus Master”. This is the most critical step, as it designates the port as a Modbus master.

Baud Rate: 9600, 19200, 115200, etc. (consistent with the slave)

Data Bits: 8 (usually)

Stop Bits: 1 (usually)

Parity: None, Even, Odd (consistent with the slave)

Note: In Inoproshop, once the operating mode is set to “Modbus Master”, the system will automatically create a corresponding “Master” device for this port, which will appear in the device tree.

Step 2: Add Modbus Communication Library

In the toolbox on the right, switch to the Library Manager.

Check if the Modbus Serial Line library already exists. If not, you need to add it manually:

Right-click on Library Manager -> Add Library…

Select from the library repository or install from a local file. The standard Modbus library is usually named Modbus Serial Line or MbSerial.

Step 3: Write Program to Call Function Block

The commonly used Modbus RTU master function block in Inoproshop is MB_MASTER, located in the Modbus Serial Line library.

Create Program Organization Unit (POU): Add a program (e.g., PRG) to your project.

Declare Variables: Declare the function block instance and necessary variables in the variable declaration area of the POU.

structured

VAR

// Modbus master function block instance

mbMaster1 : MB_MASTER;

// Control variables

xStartRead : BOOL; // Rising edge signal to trigger reading

xReadBusy : BOOL; // Reading in progress

xReadDone : BOOL; // Reading successfully completed

xError : BOOL; // An error occurred

iErrorID : INT; // Error code

// Data buffer: Used to store the 10 register values read back

aReadBuffer : ARRAY[0..9] OF WORD;

END_VAR

Call the function block in the program body (using ST language as an example):

structured

// Trigger using rising edge to prevent continuous calls

IF R_TRIG(xStartRead) THEN

xReadBusy := TRUE;

END_IF

// Call MB_MASTER function block

mbMaster1(

REQ:= xReadBusy, // Request signal, using busy signal after rising edge trigger

PORT:= ‘COM2’, // Port name, consistent with the name in the device tree, usually ‘COM2’

SLAVE:= 1, // Slave address

MODE:= 0, // 0=read, 1=write, 3=write single register, etc. Please refer to the help documentation

DATA_ADR:= 16#0000, // Starting address (hexadecimal). The offset for holding register 40001 is 0

DATA_LEN:= 10, // Number of registers to read

DATA_PTR:= ADR(aReadBuffer), // Pointer to the data buffer

DONE=> xReadDone, // Completion flag

ERROR=> xError, // Error flag

STATUS=> iErrorID // Status/Error code);

// Clear busy signal when communication is complete (whether successful or failed)

IF xReadDone OR xError THEN

xReadBusy := FALSE;

END_IF

Key Parameter Explanation:

REQ: Triggered by a rising edge pulse, cannot always be TRUE.

PORT: Must exactly match the port name of the “Modbus Master” configured in the device tree (e.g., ‘COM2’).

MODE: Function code selection.

0: Read multiple registers (function code 03)

1: Write multiple registers (function code 16)

3: Write single register (function code 06)

(For specific correspondence, please refer to the MB_MASTER function block description in the Inoproshop help documentation)

DATA_ADR: Modbus protocol address, i.e., the offset in the slave address space.

For holding registers (4xxxx), address = 4xxxx – 40001 = 0.

For input registers (3xxxx), address = 3xxxx – 30001 = 0.

For coils (0xxxx), address = 0xxxx – 1 = 0.

DATA_PTR: Use the ADR instruction to get the address of the array or variable you declared.

Part Three: Debugging and Common Issues

Online Diagnosis:

Compile and download the program to the PLC.

Click Login for Online Monitoring.

Force or trigger your xStartRead variable.

Observe the status of xReadDone, xError, and iErrorID.

If xError is True, record the value of iErrorID. Common error codes:

0x8384: Slave no response/timeout (check wiring, address, parameters)

0x8385: Frame reception error (parity, baud rate mismatch)

0x8386: CRC check error (line interference, parameter mismatch)

Trace Function:

Inoproshop provides powerful tracing capabilities. You can right-click on your “Modbus Master” device in the Device Tree and select Add Trace.

In the trace configuration, add the variables you want to monitor (e.g., aReadBuffer).

Start tracing to visually see the data exchange process, which is very helpful for debugging.

Ensure Periodic Calls:

The above example is a single trigger. In practical applications, you may need a timer to periodically trigger the MB_MASTER function block for polling.

Summary

The core process of configuring the AM500 as a Modbus RTU master station in Inoproshop is:

Hardware Wiring: Correctly connect A, B, and GND.

Device Configuration: Set the operating mode of the corresponding serial port (e.g., COM2) in the device tree to “Modbus Master” and configure the correct baud rate and other parameters.

Programming: Use the MB_MASTER function block and correctly set PORT, SLAVE, MODE, DATA_ADR, and other parameters.

Trigger Logic: Ensure to use a pulse signal to trigger the REQ pin to avoid continuous calls.

Debugging: Utilize online monitoring and Trace functions to locate issues through status bits and error codes.

Leave a Comment