■Overview
The following is an example of connecting to our CONPROSYS nano series remote I/O communication coupler "CPSN-MCB271-1-041".
If Communication is not Successful
Follow the steps below to connect to the communication coupler unit with ModbusTCP.
For the hardware details, please refer to the product manual.
Connect the host PC on which this sample
collection is installed and the communication coupler unit with a LAN
cable and turn on the power.
For the network settings (IP address) on host PC, please refer to the product
manual.
The default IP of the communication coupler unit is 10.1.1.101.
The communication coupler unit can acquire the connected module information by Modbus protocol.
An example of acquiring the 0th bit data
in the communication coupler unit with the following configuration is
shown.
1st slot : CPSN-DI-08L
2nd slot and after : Not connected
1. Modbus connection
Specify IP address and port with modbus_new_tcp function, and connect to the communication coupler unit with modbus_connect function.
2. Data collection
The data in CPSNDI-08L is mapped to 0-7 in the Modbus DiscreteInputs register.
Data can be obtained by using ReadDiscreteInputs (code 02).
- Reading example which used a sample
Functions used : modbus_read_input_bits function
■If Communication is not Successful
If Modbus communication cannot be performed normally, please try a simple operation check.
You can also check the operating status of the communication coupler unit from the LED lamp or the Web setting screen.
Please refer to the product manual for details.