Future digital factories are supposed to be controlled by cyber physical systems (CPS). This means that plant components can control the process autonomously without need of a big central automation system. Those modular system structures are very flexible and can be easily adapted to changing processes. This paper presents an example for controlling a robot arm by a microcomputer programmed like a PLC. The PLC-Software based on standard function blocks can easily be plugged together and distributed to several CPS.