plcLib (Arduino): Strengths and Limitations

The plcLib software is freely available, and allows simple PLC-style programs to be developed on low cost Arduino compatible hardware. As such it offers an affordable entry point for those wishing to develop control-oriented software applications, or to use the Arduino for related educational purposes.

Commands are written as extensions to the C/C++ programming language, and hence make use of a C/C++ compatible command syntax. Programs may be designed using ladder diagram, function block, sequential function chart, or structured text, but must be entered into the Arduino IDE in a text-only format, commonly known as instruction list. However, this process becomes easier with practice, and is aided by the availability of examples.

While the command syntax is not identical to any particular manufacturer, it should be straightforward to transfer existing knowledge between systems, or to compare operation of a given feature against the appropriate standard (IEC 61131).

The following points may be useful when deciding whether or not to use a plcLib-based solution in a particular situation.

  • The ladder logic approach is particularly effective when implementing systems which can easily be represented using a ladder diagram, block diagram, or sequence-based system. These systems often involve performing a significant number of tasks in parallel, which is a particular strength. For other systems most easily represented using a flowchart, or similar, then a traditional programming approach may be more effective. In some cases it may be possible to use a combination of these approaches, perhaps making use of structured text.
  • The scan cycle will inevitably slow down as more parallel tasks are added. Care should always be taken to ensure that the system response time is adequate for the system being controlled.
  • The system may in some circumstance require several passes of the scan cycle to complete complex calculations, and intermediate results or 'glitches' may briefly occur at this time. In addition, outputs are updated at each step in the scan cycle (not just at the end). You should test programs carefully to ensure that any intermediate results will not affect the correct operation of the system.
  • In general, you should avoid using the delay() command in ladder logic programs, as this halts the scan cycle for the duration of the time delay (software debugging is an exception, where the aim may be to deliberately slow down the scan cycle). If time-based operation is required then consider using a timer command such as timerOn(), timerOff(), timerPulse() or timerCycle(), as these use an interrupt driven approach which does not affect the scan cycle.

Related Topics

top