MAIN() main program

In the MAIN program an instance of the FB MCV_HliInterface from the HLI library is first calculated. This FB checks whether the HLI interface on the PLC side corresponds to the interface on the motion controller side. Here the FB must be calculated several times. Only when the output Initialized of the FB is TRUE and the output Error indicates FALSE can access be made to the HLI, the interface between the PLC and the motion controller.

For this reason an instance of the FB MCV_PlatformBase may only be invoked later. Axis references are initialised with this FB. Only after the FB signals by the Done output = TRUE that the axis references can be used, can an instance of the FB MCV_P1_PLATFORM be calculated. This FB must be invoked cyclically in the PLC application. The FB ensures that error messages are received by the motion controller and are forwarded to every FB via the axis references. This permits every FB to respond to problems with the axis which it commands.

The application code is inserted after this FB.

The MAIN() program is then assigned to a task.