When creating TwinCAT software I’ve come across a use case where I want to print out and store the actual version of the project that the program resides in. This can be pretty neat when you do version control, and for instance create a release of your program and want this information available somewhere in the output of the program. I’ve had this scenario when we had a project that was continuously updated. The test/integration team needed constant bug fixes/new software releases. As a software engineer I needed to keep track of what version the test/integration team were actually running at a specific time. By updating the version number in the project information I was being able to log the actual running version of the software in a database, which is important to know when going back to fault trace any strange behavior in a particular test.

Read more

PLCopen has released their coding guidelines for 61131-3 structured text (ST) some time ago. If you haven’t read that yet, I highly recommend you to do so! Even if I don’t agree with everything, it’s still a good read and a really good initiative to consolidate all the different coding guidelines that every vendor has for their 61131-3 ST environment.

Included in this is Rule L16 “Define the use of tabs”. Let me quote:

Use of tab character (ASCII code 9) should be avoided, and Programming Support Environment set to replace tabs with spaces

This is a common rule in many projects, as this simplifies copying of code into other contexts and makes the code less dependent on the user settings for display. Simply put, the visual interpretation of a tab character varies wildly. As the TwinCAT development environment integrates into visual studio, this is the place we need to do our change. I’m going to use visual studio 2015 community edition for this particular demonstration, but it should be more or less the same in the other versions of visual studio.

Read more

When integrating various forms of devices, generally speaking there are usually requirements that a certain degree of fault isolation of those devices needs to be done. EtherCAT slaves specifically can transmit emergency objects (EMCY) – a protocol inherited from CANopen. An emergency message is a high priority message sent once, and is triggered by an error event in the EtherCAT slave device.

Normally the emergency objects are showing up in the visual studio development environment, but that might not be enough. At one occasion I wanted to be able to handle the emergency objects in PLC code. Handling and reception of the emergency objects via the diagnosis history object will be explained in two parts – first we’re going to start with the theory of the diagnosis history object. In the second part we’ll create function blocks to implement handling of the diagnosis history object. The first part is out and can be located here!

Warning Icon by Martz90 / CC BY

Read more

Webpage is up! Here I’m going to have various information about different PLC programming tutorials. This will mostly be in the TwinCAT 3 and CODESYS environment. I’ve found out that there aren’t too many blogs/resources on TwinCAT 3 development. As I’m working with mostly TwinCAT-development every day at my job I thought it would be a good idea to share some of the knowledge I’ve aquired during as time has passed. Stay tuned!

Read more