Author |
Message |
micelan
|
PostPosted: Mon May 02, 2016 7:34 am |
|
Joined: Fri Apr 29, 2016 7:07 am Posts: 7
|
Good morning, I'm a newby to codesys (V3.5.7), I'm currently reading the 'input variable' by modbus by using the slave modbus/Channel slave modbus/Read Holding Registers and declaring them in global variable. I can write on this node as well by using 'Write Multiple Register' but I need to write the value only when I change it, not cyclically. To better explain, I have a net in which the same value should be written from local (plc on the machine) or remote (plc controlled by codesys). I have to maintain the last value written (from local or from remote, same importance). I'm sure it should be done quickly but I can't find the solutions. Any suggestions?
|
|
Top |
|
 |
learnetk
|
PostPosted: Mon May 02, 2016 2:18 pm |
|
Joined: Fri Aug 07, 2015 9:59 pm Posts: 57
|
Hi i think you should be able to do it with the 'Rising Edge'. You just Need a variable that would be triggered when the Value changes and this could be mapped to the 'Rising Edge' variable.
You do not have the required permissions to view the files attached to this post.
|
|
Top |
|
 |
micelan
|
PostPosted: Mon May 02, 2016 3:47 pm |
|
Joined: Fri Apr 29, 2016 7:07 am Posts: 7
|
Thankyou very much for the respons.
I made something like this:
2 writing, one is for the trigger variable and the other for the value I want to change. 1 reading, that is pointed to the same value of the second reading.
I was espected that if I put one on the trigger variable (which come to true), the value on the writing should pass to the reading as well. But no way to connect the trigger variable to the action that identify the changing of the value on the plc?
Thank you very much.
|
|
Top |
|
 |
Vijolica555
|
PostPosted: Mon Feb 11, 2019 5:37 pm |
|
Joined: Wed Jul 11, 2018 10:44 am Posts: 12
|
Hello, I would like to do smt simmilar.. I want to save value everytime it changes and cyclicly every 15 min for ex.. How i detect change? Did you succed to write program for it? Thank you.
|
|
Top |
|
 |
dFx
|
PostPosted: Tue Feb 12, 2019 2:36 pm |
|
Offline |
Frequent User |
 |
Joined: Fri Feb 23, 2018 3:41 pm Posts: 100
|
just read the source variable cyclically to know the value. Then compare with one you previously saved. If values are different, then trigger your write.
|
|
Top |
|
 |
Vijolica555
|
PostPosted: Fri Feb 15, 2019 8:44 am |
|
Joined: Wed Jul 11, 2018 10:44 am Posts: 12
|
Well.. I have problem with comparing bytes. With BOOL variable works fine: IF NOT new = Old THEN Save := TRUE; Old := New; END_IF
With BOOL All good, Save goes TRUE but with BYTE not.. Nothing happens.. Any ideas?
Update: I used memcmp and memcpy. It works now.
|
|
Top |
|
 |