How to read Modbus RS485 on plc

Hello,

I have an electric meter connected with Modbus RS485 to the PFC300 and I want to read the values from codesys. How can I do that please ?

update :

Hi,

Please validate that you got Modbus Master device at upstream of Slave device.

I have this

Looks like the true one.

Then you should set right Unit ID for the Slave device and configure the Modbus Channel with preferred list of registers to pool from meter, afterwards map the variables and call this variable from POU to get it pooled from Slave device.

I mapped the register with my variable but the value is still 0 and I have the warning “Bus doesn’t work. it may be that the values displayed are no longer current”

The defined variable in my program is :

TestSignal : WORD;

Hi,

is the red marked variable mapped to your TestSignal variable?

TestSignal is declared as WORD and the mapped variable is declared as ARRAY [0..0] of WORD. You have to map the variable in the second line where type is word.

Then you have to use the variable in the program also.

First, you have to be sure the communication part work before talking about variables.
Can you do a screenshot of the slave “General”, “Canal serveur Modbus”, “Init serveur Modbus”.
Thanks.

For the start address in the canal server I set to 16#C550 because of the documentation of the meter I use : MODBUS tables of Countis_E43

Yes it’s mapped to my variable, oh okay I understand, I will test , thanks

It don’t works :confused: but thanks for your help

Seems weird.
Can you try in the variable, instead of linking a variable from the project, declare a variable in the “ModbusGenericSerialServer Mappage E/S” and call this variable in your program.
Thanks.

image

Did you try to connect to the device directly and count this register? For starters, it is necessary to count directly through the cable and then do it in the program. Cables A and B are installed correctly? Could you confuse?

Hi,

No I didn’t try because I’m not on site but the staff on site said that everything is connected correctly so I don’t know what the problem can be

Is the serial interface configured to RS485 in WBM? Administration - Serial Interface.

Yes it is configured

I have this by default

I don’t know if it’s useful but I’m connected to the controller remotely via VPN.