If you’ve done development in TwinCAT for some time, you’ve most likely come across at least one of the OSCAT libraries. These are open source libraries developed in accordance to the IEC61131-3 standard. They provide a total of three different libraries; OSCAT-Basic, OSCAT-Building and OSCAT-Network. I’ve so far only used the OSCAT-Basic library, which provides function blocks and functions for engineering, mathematics, string handling, time/date and much more. There is only a small problem with using the OSCAT-Basic library in TwinCAT – there is a broken reference in it! What follows is a guide on how you can fix this so that you can fully utilize this library in TwinCAT.
3S-Smart Software Solutions has since pretty long had a Raspberry Pi (RPI) target image available for their CODESYS runtime. The intention was to create something that you could buy very cheap, primarily for students and such to learn how to program 61131-3.
As I’m primarily working with TwinCAT3, which is based on CODESYS, I’ve been thinking about building a really cheap 61131-3 compatible PLC based on the RPI and the CODESYS target. I didn’t just want it to be one board laying around in my home, but I also wanted it to have the “industrial” feeling, and luckily I found a perfect development board + case for me to initialize the project. Now that it’s finished, I have a PLC running an EtherCAT master in the CODESYS runtime for almost no money at all.