I put it in a nice little AOI so I can easily copy the code to all my different projects along with error status/messages, PLC serial number, firmware revision, etc.[/quote]Nice! Anything you’d be willing to share?[/quote]
Sure (EDIT: See this post a little further down in this thread for an updated version of this AOI)
2 Basic principles we work with are the idea that
A) Blocks should be top end agnostic. As a result any tag I want to read in the HMI is brought out of the AOI and requires a controller tag to be created (since not all HMIs are proficient at reading tags inside of AOIs, especially if you start nesting AOIs within AOIs)
B) All Alarming is synchronized with the PLC as much as possible. So on my block you’ll see Acknowledged bits (ACKD), Acknowledge commands (which I got lazy on and did not expose breaking principal A, ), and alarm active bits (ALRM). Since the alarming is only used for notification purposes it won’t affect the process if you completely ignore these bits.
The block should have some basic comments on the code itself and the tags used in it. It was created using ladder logic because I was working on a project that had limited space and it turns out structured text code is almost twice the size as its ladder logic equivalent. Who knew?