Machine Automation Forum
A forum addressing machine automation solutions for the complete machine lifecycle. Including offers like Machine Advisor, Modicon PLC/PacDrive, Lexium or Preventa. Discuss and share knowledge on offers relating to cloud-based service platforms, machine localization and monitoring, industrial operations control, motion products as well as safety function!
Link copied. Please paste this link to share this article on your social media post.
Posted: 2022-01-31 07:18 AM . Last Modified: 2022-01-31 07:21 AM
So, I´ve been trying to develop a way to save alarms on EEPROM for the TM171/TM172 series. The idea is to save both the alarm code and the alarm date (without seconds). I am using a very simple protocol to store both data on a single UDINT variable.
Following this video (https://www.youtube.com/watch?v=h5dQ8tfF2dM&ab_channel=SquishyBrained) I reserved 20 UDINT EEPROM variables and I figured I would save the first alarm at the first reserved memory position and then when a new alarm comes, move the n-1 alarm to the n position, n-2 to n ... first to second and save the newest alarm at the first position again. Since EEPROM memories last 100,000 cycles I think there´s a very good chance that I will not run into EEPROM failure soon.
In the video, they use a built-in FB that takes care of this move, it is called memmove in Twincat but it does not seem to exist in Ecostruxure HVAC libraries. So I do this by using a FOR-LOOP block which works well in simulation but crashes in a real PLC if the number of reserved EEPROM variables grows.
So my questions are:
1) How can I troubleshoot this ? How do I know how many variables I can move and write ?
2) Generally speaking: can a FOR LOOP that takes too long (but not an infinite loop according to simulation) crash the PLC ?
3) Is it ok to use systimer to calculate timing on the PLC ?
4) In these rare cases when it is easier to use a FOR LOOP to complete a long but "rare" task, is it safe to use either syswd_Timed or sysWD_Backgroud to allow the for loop to complete? Is there an example somewhere on how to use these functions ? I found a very rare animal fishing trying to google for sysWD_timed 🙂
Link copied. Please paste this link to share this article on your social media post.
Link copied. Please paste this link to share this article on your social media post.
Link copied. Please paste this link to share this article on your social media post.
Link copied. Please paste this link to share this article on your social media post.
Link copied. Please paste this link to share this article on your social media post.
Create your free account or log in to subscribe to the board - and gain access to more than 10,000+ support articles along with insights from experts and peers.