Converting the Ladder Logic Multivibrator to a User Defined Function Block (Tutorial)

Lessons Worth the Struggle

I must admit when I first undertook the task of creating the multivibrator, I figured it was going to be a math-ridden complication and expected a good deal of struggle as it was more than just making blinking lights go on and off at intervals – replicating the components would require functions and thoughtful placement for it to properly operate. This went about as expected – a few hiccups here and there but overall, nothing that was absolutely stumping. Having made some simple User Defined Function Blocks before, I anticipated this tutorial was going to be extremely easy and almost not even worth writing. I was dead wrong. The complications that arose from eliminating the global variables and instantiating blocks within blocks were a bit demoralizing. Here is the catch – after moving, troubleshooting, correcting, and completing the project I realized that the problem originated not from the code itself, but from my lackadaisical approach. Ladder Logic is a type of programming code, after all, and when you start moving things around without the proper care, it will brutally remind you of every little gap in understanding you might have with whatever you are working with. So, with all of that confidence I had going into this tutorial, I now walk out on the other side victorious, but humbled and with a much better understanding of the individual parts.

Read the full tutorial here:
User Defined Function Block Tutorial.docx (491.9 KB)