Example of a PLC with a function