1/5/2010 2:11 PM | |
Joined: 10/7/2005 Last visit: 6/6/2023 Posts: 2966 Rating:
|
Hello ivan_euler as Sydney quite rightly already said, the code implementation isn't "optimal" but will work IF MD102has a valid a value in it (in your case this meanseither 1, 2, 3, 4 or 5). The other conditions that need to be fullfiled are: - DB50 MUST exist in the PLC and MUST be at least 12 Bytes long. - PIW256 must "exist". Assuming the above conditions are met your code will work without problems (note though that MD102 will be reset to zero after a PLC restart unless it is part of the retentive memory bytes area). Having said the above, I'm not too sure about the intent/desired functionality of your code. The logic does sort of create ringbuffer (last 5 AI values are buffered in DB50.DBW0 to DB50.DBW8 except for the one that is "spat out" in DB50.DBW10) and every 5th AI value is "spat out" (or 'sampled") in DB50.DBW10. I hope this helps |
Cheers |
|
Follow us on