1. Prepare a YX-AI-DO2S two-way analog input device

2. Physically connect YX-AI-DO2S with the analog sensor and the host computer as shown in the figure below

3. Configure the serial communication parameters through the configuration software, so that the YX-AI-DO2S and the upper computer and the lower computer sensors can physically realize the communication state.

4. The host computer sends Modbus acquisition commands to the lower computer equipment for reporting

Example of function code (YX-AI-DO2S manual contains all commands and function codes):

Example 1

Use the 03 function code to read the floating-point number AI1

Send: 01 03 00 00 00 02 C4 0B

Use the 04 function code to read the floating-point number AI1

Send: 01 04 00 00 00 02 71 CB

Accepted: 01 04 04 40 9E CE 1F 9A 02

Example 2

The analog reading conversion formula is as follows (Example: convert voltage to temperature value)

AI = a * ratio + offset

AIx is the converted value:

a is the reading value before conversion

ratio is the set ratio factor (initially 1.0)

offset is the set position coefficient (initially 0.0)

5. Realize data collection and report to the host computer.

Leave a Reply

Your email address will not be published.