Jump to content

MODBUS 485 Help


Recommended Posts

Hello.

 

I am having trouble with the MODBUS read / write.


I have an empty project uploaded to the PLC, and to test communications between the PLC and my pressure controller, I have simply setup MODBUS 485 Master to communicate.

I have setup the PLC to communicate with the controller and MODBUS link is successful.

I am reading the pressure successfully from the controller on address 1203. The pressure is sent to the PLC without problems.

I am trying to write the setpoint from the PLC back to the controller on address 1010 but this does not seem to work.

I have setup a Registers Periodic operation to write to address 1010 but it does not work.

Please could you advise what I am doing incorrectly?

I have attached links to the Alicat documentation detailing the MODBUS settings of the controller:

https://www.alicat.com/wp-content/documents/manuals/ModbusRTU_Manual.pdf\"]https://www.alicat.com/wp-content/documents/manuals/ModbusRTU_Manual.pdf

https://www.alicat.com/wp-content/documents/manuals/DOC-MANUAL-MPL.pdf?_gl=1\"]https://www.alicat.com/wp-content/documents/manuals/DOC-MANUAL-MPL.pdf?_gl=1*jlekf*_gcl_au*MjAxNDI3NDk1NC4xNzA2MTE0MDQ0

Link to comment
Share on other sites

hi @russedwards

error code 3 means "illegal data value"...description from the web: A value contained in the query data field is not an allowable value for the slave.  This indicates a fault in the structure of remainder of a complex request, such as that the implied length is incorrect. It specifically does NOT mean that a data item submitted for storage in a register has a value outside the expectation of the application program, since the MODBUS protocol is unaware of the significance of any particular value of any particular register.

so...when you read the register what you have as value ?...did you try send exactly the same value to check if it is valid?

Link to comment
Share on other sites

According to the Alicat manual, "The device setpoint should be sent as a 32-bit IEEE floating point value. Setpoint values must be sent together in a Write Multiple Registers command. Any writes to only one half of the setpoint value will cause an error. Setpoint is ignored on devices without a controller".

 

Are you fulfilling this requirement?

 

Link to comment
Share on other sites

Gabriel,

when you carefully read the alicat manual, you must send 2 modbus commands to set the setpoint...

you must send the first 2 bytes to adress 1010 and the second 2 bytes to adress 1011... (i think) (taking care of big or little endian)

so you can not send a real, but 2 int16 variables ! so you have to split your real into 2 int16 variables

image.png.26457d0a25147b75de21a170f67085f8.png

 

Link to comment
Share on other sites

have you tried to do it with aperiodic sending ?

I don't know if the periodic sending is done on how you program your modbus thing.

If you program a aperiodic, then you send your group in 1 command.

but like ausman said -> maybe a good idea to send it with a pc software

Link to comment
Share on other sites

  • MVP 2023

And I also agree with Gabriel's interpretation.  "together in a Write Multiple Registers command"

However, I do find this manual a bit confusing, given I can't find setpoint setting in any of these commands : Commands can be issued to the Alicat device using Modbus register1000. Commands are described in the table below. Some commands require a parameter to be passed in Command Argument register 1001 using the “Write Multiple Registers” Modbus function code.

But then we also get to the legacy stuff at the end, so perhaps you should be trying register 24.  Look in 2.1

So with all this confusing info, I still reckon your easiest avenue at present is using the PC.  I always start with a new device on the PC, and often find contrary things which take some time to figure out, along with other registers which have no reference in the manual but actually contain useful stuff.  It can be a "fun" game stepping through registers as a first try at a block of 10 and see if it reads ok, or then go to one by one.

cheers, Aus

Link to comment
Share on other sites

But according to your printscreen you do not send multipleregisters. In fact you are trying to send each 100 ms to one value to 1010 and to 1011. I think in fact you each 100 ms queue modbus function 0x10 for 1010 and then for 1011.

If I perform function 0x10 in UniLogic I define an array. In your case it should be array of size 2 of INT16 say asetpoint[0..1].  Then asetpoint[0] is int16 value for 1010, asetpoint[1] is int16 value for 1011

In modbus section then each 100 ms 0x10 or 16dec (Write multiple registers), address 1010, tag simply asetpoint. If UniLogic offers you to select particular value like asetpoint[asetpoint_0] when typing in, just delete it. In the column address ther should be asetpoint only. This causes asetpoint[asetpoint_0] will be written into 1010 and asetpoint[asetpoint_1] to 1011 matching the requirements of pressure transmitter the setpoint values are transfered together.

Hope it helps.

Jan

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.

Guest
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...