CODESYS - the IEC 61131-3 automation software

Welcome to the official CODESYS Forum by 3S-Smart Software Solutions GmbH | A member of the CODESYS Group
Deutsche Version English version russian version 
It is currently Thu Dec 13, 2018 4:38 am

All times are UTC+01:00




Post new topic  Reply to topic  [ 4 posts ] 
Author Message
PostPosted: Fri Nov 30, 2018 8:10 am 
Offline

Joined: Mon Jan 22, 2018 10:07 am
Posts: 45
I have defined a Slave Device in ModbusTCP, as in picture 1 attached.
I defined the registers as picture 2 attached.
When the partner writes to an holding register I receive correctly the value, but I need to overwrite is after a while.
Codesys does not permit to me to do this, picture 3.
How can I overwrite the register?
Thank you


You do not have the required permissions to view the files attached to this post.


Top
   
PostPosted: Sat Dec 01, 2018 8:17 pm 
Offline
Frequent User
Frequent User

Joined: Wed May 04, 2016 6:00 pm
Posts: 259
Hi

You cannot write an input.

Sent from my Moto G (5S) Plus using Tapatalk


Top
   
PostPosted: Mon Dec 03, 2018 2:24 am 
Offline

Joined: Mon Jan 22, 2018 10:07 am
Posts: 45
yes but they are Holding Registers and according to Modbus specification holding register can be read and written at the same way. May I use a library to achieve it?


Top
   
PostPosted: Mon Dec 03, 2018 3:51 pm 
Offline

Joined: Fri Feb 23, 2018 3:41 pm
Posts: 64
Modbus is a one way communication, It only allows one master to read/write into a slave. That said, if, Inside your slave, you need to update writeable values then you have several workarounds :

1) Don't always write with master, if you can edit it. Just write when you have to transmit a value change. You must read back the value with the master to update it on the master. Otherwise your master with have a different value than your slave.

2) You have no way to not write cyclically, then you may read before write. Meaning, first master reads, then update internally the write value. Then master will perform writes on your slave. This has one drawback : in case of writing your value just after the read and before the write, it will be overwrited by master's value. Operator/program may have to write more than once the value to correctly update it. This works best with low cycle time (modbus wise).

For exemple :
We have a setpoint on the slave. The slave may limit it -> this would be continuous value update (slave side) and will work flawlessly (protecting the setpoint before using it)


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 4 posts ] 

All times are UTC+01:00


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Limited