This sample demonstrates the use of programming with ST language.
- ST language
- Using the ST editor
- BLINK, F_TRIG and CTU function blocks
- ANY_TO_BOOL and AND_MASK functions
- Calling a function block
- Declaring I/O boards in the variable editor
- Using defined words
The application is divided into two ST programs. The first "PMAIN" program performs the following operations:
- Chain calls to a BLINK block and a F_TRIG edge detection block so that the rest of the program is executed only once each second.
- The rest of a program is a simple activation of a CTU up-counter function block. The output of the block is reset to 0 when the variable bCommand is FALSE. Counting output is the iValue DINT variable
Note that the blinking period "ThePeriod" is a definition declared globally in the "Global defines" and is equivalent to the "t#1s" constant expression.
The second "ActuateOutput" program performs mask operations so that the 8 lowest bits of the iValue variable are copied to boolean I/O variables.