Modbus Master Serial with 750-652 module

Hi all,

I have already checked the forum and other forums for similar issues with the 750-652 card from others, and followed some of the advice but without success.

I am trying to implement a FbMbMasterSerial function block to read (only) data from a RS-485 Modbus connection on the Kbus of a PFC200 8210 with a 750-652 card locally using Codesys 3.5.

This has been unsuccessful so far, as I am receiving no data in the “utResponse” section when running the FB. I have followed the documentation and configured, to my knowledge, the FB correctly. But upon running I have no data, and an Error code, wError = 2.

I have made sure that the settings are correct and there is infact data available on the other end, with another software to check, see attached.

Perhaps the register address is incorrect, although I have tried various numbers in the uiReadAddress parameter. The function code is 3 (Read holding registers), address starting 4099, which is 1003 Hex, I also tried without the 4000 “suffix” so 99 in both decimal and hex 63.

What else could be the cause? And thoughts or pointers to anything I might of missed?

Thanks in advance


.

What is your slave ?
Are you sure about wiring, communication parameters (Baudrate, Parity, Stopbits…)
Even it looks it’s more an error in the address a double check is always welcome.
To use hexadecimal address, add 16# to the value (16#63)
Sometimes addressing starts on 1 and not 0, so try address +/-1.
Sometimes you can’t read a part of a register (if it’s on several words for instance)

1 Like

Ah Quentin, swift response as always, thank you!

The slave device is a power converter. The physical layer is correct, as I can read from my laptop with a USB to RS-485 converter. On the 652 I have followed the manual, and connected as follows:

A wire to D3 terminal jumpered to D1 terminal
B wire to D2 terminal jumpered to D0 terminal

The C LED shows flashing (RxD Present). But I tired also inverting A and B, and removing the jumpers to the second terminal.

There is no other Slave on the bus. Parity, bits and stop bits is correct, same settings as used on the other software on the laptop.

I will have another go at changing the addresses and wiring configuration again now.

From what you can see the declaration and call of the FB appears to be correct?

Thank you.

Have you confirmed the 652’s settings in I/O Check?

1 Like

Could you try changing the read quantity ? A modulo 2 quantity for instance ? (32 like in your configurator)

1 Like

Hi Quentin and Jgovek,

Fantastic support and suggestions, thank you. It seems that now it works!

I had checked in IO Check, and set the signalling parameters and spec up correctly, I double checked this a few times, thanks for the suggestion jgovek.

However what seemed to resolve the issue was purely trying what Quentin mentioned about writing the register address in HEX with the 16# prefix. So I tried for instance 16#1002, and it worked!

Strange because I tried all sorts of combinations of 4098 which is exactly 1002 hex in decimal. I even tried just 98 without the 4000 prefix and also to be sure 1002 and 02 in case it required hex address.

Glad this is resolved. Now I have just one more detail I am stuck at (regarding Ethercat IO 16Channel modules not providing a Word process image, unlike the Kbus installed local modules) %QW… vs %QX…, but that’s a separate topic.

3 Likes