Some of the guys at the office just got back from a SoMachine Motion CODESYS session in Germany. One of them noted a CODESYS tip/trick to change the variable name prefixes or suffixes that will save programmers a lot of time and tedious work.
Holding down the Alt key allows for a vertical highlighting feature.
From the example above:
Changing the word ‘Read’ to ‘Write’ can be done in one quick update for the entire list:
This is useful for common parts of a variable name, like above. Other examples may include:
- Change user defined data type names on a set of assignments.
- Adding a prefix to a mirror set of variables- e.g. SCA to variables shared with a SCADA system.
Look out for:
‘Copy and paste’ ( Ctrl-C, Ctrl-V) is a large source of PLC program bugs and errors. Several articles on programming cover the ‘copy and paste’ issues in depth. A cool feature like this Alt-key highlighting might feed the problem.
As such, practice caution. Saving a few minutes in tedious work is good as long as it doesn’t cause hours of troubleshooting later. Follow through with a visual check to pick up errors. Copy and paste does not negate the need for System 2 thinking which is the conscious and logical thinking instead of the subconscious and automatic thinking.
Having said that, this is one CODESYS trick I wished I had learnt a few years ago. Thank you, Jared.