# How can I convert DI/DO read as 16-bit words to coil status with Modbus 485?

## Recommended Posts

Hello,

a customer is trying to read inputs and outputs on a Samba PLC using Modbus RS485.
They are using a Siemens Simantic S7 ET200 PLC to do so. But it can only read coils in range 0-9999.
The Samba digital outputs start from 16384 (4000h) and the digital inputs from 24576 (6000h).

The only thing they can read in the range above 9999 is 16 bit words with Modbus function 04.

The question is, how can they get the coil status information they need from the 16 bit word? Does anyone have a clue how to solve this? Comment from the customer below.

"That means we have to split the word with 16 bits into its individual bits and speculate if these individual bits contain the desired information that we need.

Where is the start address? Let's start with the address as you specified at 24576 and read in a data length of 10, With the normal approach, this would be the addresses 24576-24585 as bit operands, i.e. 10 individual bits.

Let's read it in as input words  and start at 24576 with a length of 10, this would also be the addresses 24576-24585 as words with 10x16 single bits.

The problem for us now is where exactly is the information we need? Can we assume that the first 10 bits of the first word from address 24576 onwards also correspond to the bits you specify or every first bit of each word is the bit that contains the information?"

Any help would be appreciated.

Best regards Peter

##### Share on other sites

• PeterFukt changed the title to How can I convert DI/DO read as 16-bit words to coil status with Modbus 485?
• MVP 2022

You should be able to use a Vector Struct function block for this.

##### Share on other sites

What I meant was how they can read the inputs and outputs. The customer nor I wish to make a change in the program so we are hoping they can somehow get the coil status from the 16 bit work somehow.

##### Share on other sites

• MVP 2022

Use VisiLogic to go online with the PLC and inspect the values of the registers.

##### Share on other sites

Under the Vector tab you can use the bit to numeric or numeric to bit.

For the source of the function you can select inputs or outputs.

##### Share on other sites

• MVP 2022
5 hours ago, PeterFukt said:

But it can only read coils in range 0-9999.

As i see in siemens pdf - coil address is W#16  register - then it can be from 0000 to FFFF in hex.

Maybe issue is with correct numbering in modbus - 0 in unitronics +1 in standard modbus?

##### Share on other sites

• MVP 2022

I've never used Siemens and don't know this PLC.  I don't know how they're trying at present, but it would appear they would have to be using a dedicated comms module.....ET 200SP, CM PTP.  If they're doing it somehow else which is perhaps native on the main cpu itself, then perhaps they could put in one of these modules.

Here's a scrnshot of what I see as very relevant from the module manual.  It looks like it should work RTU immediately.

cheers, Aus.

## Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

×   Pasted as rich text.   Paste as plain text instead

Only 75 emoji are allowed.

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×