Jump to content

UniLogic Modbus Slave - What function codes are supported?


Recommended Posts

  • MVP 2014

In helping a customer integrate a UniStream into a SCADA system I have come across a curious gap in the available information.  I can't see any declaration of the function codes that the external Modbus master must use to communicate with the UniStream as a slave.  The Unitronics example and tutorials use a UniStream as the master as well as the slave, which doesn't highlight this issue.  

I have looked within UniLogic, tried exporting the Modbus registers as excel, looked at the UniLogic help file, watched the Unitronics YouTube video and searched the forum.  None of these sources gave the necessary information


So far I have gleaned that the following codes are supported on a UniStream modbus slave:


Read Coils (function code 1)

Write Coils (function code 5)

Write Multiple Coils (function code 15)



 Read Holding Registers (function code 3)

Write Single Register (function code 6)

Write Multiple Registers (function code 16)


But what if the customer's master only supports Read Input Registers (function code 4)?  I don't have a firm answer on how we could handle this.

Can anyone provide a definitive list?  I would like to be able to answer this question with confidence.  A standard part of documenting a Modbus Slave is to specify which function codes it supports, so the master can be correctly programmed.







Link to comment
Share on other sites

Dear Simon,

Thank you for contacting Unitronics support Forum!

About the MODBUS coding definition on UniLogic the configuration goes as following:



For Reading Coils you can choose an operation of Read Coils (1) or Read Discrete Inputs (2) :


For Writing Coils it use the operation of Write Multiple Coils (15) or Write Single Coil (5) :



For Reading Registers you can choose an operation of Read Holding Registers (3) or Read Inputs Registers (4) :


For Writing Registers you can choose an operation of Writing Multiple Registers (16) or Write Single Register (6) :



Best Regards,

Nahum Stern


Unitronics Tech.Support Team
Product Division
Unitronics Building
Airport City, Ben Gurion Airport
T +972 3 9778866
F +972 3 9778877  

Link to comment
Share on other sites

Hello Simon:

In the past days, I integrate to Unistream Slaves to a Ignition SCADA, and I found some issues. So we perform a TEST by doing the following:


  1. In UNISTREAM we create 5 coil registers to be readed on the SCADA:
    1. In UNISTREAM we created M0, M1, M2, M3 y M4
    2. UNISTREAM is SLAVE to the SCADA.
    3. UNISTREAM is communicating by MODBUS TCP
    4. UNISTREAM SLAVE addres cannot be changed and the default assigned in the software is 255
    5. In the  SCADA software the MODBUS configuration, we have to make some changes:
  2.                                                                i.      START reading register we have to change from 0 to 1

                                                                 ii.      In the END register we have to change from 4 to 5

                                                               iii.      The UNIT ID is not 255, we have to write  0

                                                               iv.      Modbus type Coil is the kind of MODBUS function we are using

                                                                 v.      Modbus Address should says 2 (i still don't know why, but this was the only way how it works)

  3. we did the same with the integer registers and works fine. 
  4. We where able to read all the changes we made on the UNISTREAM
  5. Prefix




    Unit ID

    Modbus Type

    Modbus Address























    Also, on the UNISTREAM software you cannot ask more that 1024 registers.


Hope this is usefull for you






Link to comment
Share on other sites

  • MVP 2014

Hi Jota, thanks for the reply.  I expected more people to jump on this.

I also found the offset of 1 between the PLC address and the SCADA address.  In my case the customer had a list of SCADA addresses they expected to see, so in practice I needed to subtract 1 from the SCADA address to get the internal PLC address.  I had no trouble with using the Slave ID of 255 on both the PLC and the SCADA.  I did my testing using ModScan.

More details from me below.


Link to comment
Share on other sites

  • MVP 2014

Hi Nahum,

Thanks for the advice.  I also did some testing using a PC based Modbus master simulator (ModScan) and confirmed the situation as well.

I also found that there was an offset of 1 between the internal UniLogic address value (in the Modbus Slave configuration) and the external Modbus address.  For example coil register 9472 appears as 09473 (Read Coils (1)) or 19473 (Read Discrete Inputs (2))

I think it would be a valuable addition to have an explanation of this in the UniLogic help file under Modbus Slave.  For example:

Coil values can be read using either Read Coils (1) or Read Discrete Inputs (2).  For example coil address 4444 can be accessed as either 04445 (Read Coils (1)) or 14445 (Read Discrete Inputs (2))

Register values can be read using either Read Holding Registers (3) or Read Inputs Registers (4).  For example Register address 1111 can be read as either 41112 (Read Holding Registers (3)) or 31112 (Read Inputs Registers (4))


Maybe add a configurable offset value to UniLogic, so this offset can be corrected in future applications, without destroying backward compatibility??  It has always been a common "gotcha" with Modbus, to discover who counts from "0" and who counts from "1".




  • Like 1
Link to comment
Share on other sites

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.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

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

  • Create New...