Which interface variables are available to the program generator?
For the PLC program generator there are two structure variables stOut and stIn in the CODESYS project. This can be used to read information from the program generator or to transfer it to the program generator.
Structure stIn
Hiding the control contact in the program generator screen
This topic is dealt with in detail in this Chapter .
// x stands for programmer 1-9. n stands for control contact 1-32stOem.astProgramGenerator[x].stIN.axControlContactEnable[n]:= TRUE;
Hiding the setpoint in the program generator screen
This topic is dealt with in detail in this Chapter .
// x stands for programmer 1-9. n stands for setpoint 1-30stOem.astProgramGenerator[x].stIN.axSetpointEnable[n]:= TRUE;
Transfer actual value to program generator
This topic is dealt with in detail in this Chapter .
// x stands for programmer 1-9. n stands for process value 1-30stOem.astProgramGenerator[x].stIN.stProcessValues.arProcessValues[n] := realvariable;
Wait function
If this function is active, the program generator is stopped after the end of each section until it is enabled again to continue.
// x stands for programmer 1-9.stOem.astProgramGenerator[x].stIN.stProgramGeneratorConfig.xProgramWaitFunctionActive := true;
Tolerance band monitoring
The value is monitored and if the tolerance band is exceeded, a message is sent and/or the programme generator is stopped until the value is back within the tolerance band.
Here more information on configuration.
// x stands for programmer 1-9.stOem.astProgramGenerator[x].stIN.stToleranceBand.rActualValue := realvariable;
Signal for activation of alarm suppression.
// x stands for programmer 1-9.stOem.astProgramGenerator[x].stIN.stToleranceBand.xAlarmSuppression := true;
Structure stOut
Control contacts
All 32 control contacts can be read with this variable.
// x stands for programmer 1-9. n stands for control contact 1-32boolvariable := stOem.astProgramGenerator[x].stOUT.stContactValues.axContactValues[n];s[n];
Setpoints
All 30 setpoints can be read with this variable.
// x stands for programmer 1-9. n stands for control contact 1-32boolvariable := stOem.astProgramGenerator[x].stOUT.stContactValues.axContactValues[n];
Program information
The structure variable Program Information contains the following variables:
Current section number
If the program generator is in home position the value is = -1.
// x stands for programmer 1-9.integervariable := stOem.astProgramGenerator[x].stOUT.stProgramInformation.iActualSectionNumber;
Remaining program time
// x stands for programmer 1-9. udintegervariable := stOem.astProgramGenerator[x].stOUT.stProgramInformation.udiProgramRemainRuntime;
Program duration
// x stands for programmer 1-9. udintegervariable := stOem.astProgramGenerator[x].stOUT.stProgramInformation.udiProgramRuntime;
Maximum section time
// x stands for programmer 1-9.uintegervariable := stOem.astProgramGenerator[x].stOUT.stProgramInformation.uiMaxSectionNumber;
Program number
// x stands for programmer 1-9. uintegervariable := stOem.astProgramGenerator[x].stOUT.stProgramInformation.uiProgramNumber;
Program name
// x stands for programmer 1-9. wstringvariable := stOem.astProgramGenerator[x].stOUT.stProgramInformation.wsProgramName;
Program generator status
The program generator status can be queried via the eMode enumeration.
// x stands for programmer 1-9. stOem.astProgramGenerator[x].stOUT.stProgramInformation.stPscModeIcons.eMode;
The following bool variables can be used to make icons visible for the program generator status, for example.
// x stands for programmer 1-9.
// Programmer is in automatic modestOem.astProgramGenerator[x].stOUT.stProgramInformation.stPscModeIcons.xIconAutomaticVisible;
// Programmer is in basic modestOem.astProgramGenerator[].stOUT.stProgramInformation.stPscModeIcons.xIconBasicpositionVisible;
// Programmer is in hand modestOem.astProgramGenerator[x].stOUT.stProgramInformation.stPscModeIcons.xIconHandmodeVisible;
// Programmer is in pause modestOem.astProgramGenerator[x].stOUT.stProgramInformation.stPscModeIcons.xIconPauseVisible;
// Programmer is in timer active modestOem.astProgramGenerator[x].stOUT.stProgramInformation.stPscModeIcons.xIconTimerVisible;
// Programmer is in toleranceband aktive modestOem.astProgramGenerator[x].stOUT.stProgramInformation.stPscModeIcons.xIconToleranceBandVisible;