Question in regard to the serial port on the M340 PLC.


Thread Starter


I have an instrument, a mass flow meter (Endress-Hauser) configured to communicate on modbus with RS485 with my Schneider Electric M340 PLC.

I configured the serial port successfully. The serial port is functional and the decoding algorithm that I programmed (conversion of two integer values to a single float value) is also working fine.

The problem is however with the values that are being received by the PLC on the serial port.

In regard to the installation of the instrument, There is a pipeline on which the instrument (mass flow meter) has been installed. The flow of material through the pipeline is controlled by a pump (Not VFD Controlled).

In regard to the program I am using a read_var block to receive the values on the serial port. I am using only one read_var block in my entire program.

I have declared a 100 point integer array, receive_buf that I connected to the RECP pin on the read_var Block in Unity Pro.

Let me take the density value received from the instrument as an example: From the receive1_buf[13] and receive_buf[14] values, my decoding program initially calculates the correct value something like 1.7 and displays it. However when power is cycled to the pump and communication is interrupted and restored the values of receive1_buf[13] and receive1_buf[14] somehow receive different values though the density value is the same on the instrument the calculation thus now shows 1.9 instead of 1.7 due to change in the receive1_buf values which is the problem.

To resolve this I tried flushing the receiving serial buffer with zero periodically once every 10 seconds. This did not resolve the problem.

When I tried reloading the program to the PLC the values in the receive1_buf automatically got corrected and the resultant calculation showed 1.7 until the power was cycled to the pump.

I would appreciate it, if someone could suggest me of a possible solution to this problem. Thank you.

Best Regards,

Conrad Kinze

Sometimes we run into issues that are difficult to deal with.

If you are only needing the values when the pump is running, you may try using the pump starter aux0 contact (run contact) to control the reading of your values. You may also need to put a 1-10 second delay in starting to read this value for the system to settle.