Last active
January 3, 2021 21:52
-
-
Save nikvoronin/08067469c0e47b775476dbf0bef652ed to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PROGRAM MAIN | |
VAR | |
Bang: BitBang; | |
Bul : BOOL; | |
Bite: BYTE; | |
Ind : INT; | |
LastTime: UDINT; | |
i, state: LINT; | |
END_VAR | |
VAR CONSTANT | |
HOW_MUCH: LINT := 100_000; | |
END_VAR | |
LastTime := _TaskInfo[1].LastExecTime; | |
CASE state OF | |
0:; // IDLE | |
100: // NOT BOOL | |
FOR i := 0 TO HOW_MUCH DO | |
Bul := NOT Bul; | |
END_FOR | |
200: // XOR BYTE | |
FOR i := 0 TO HOW_MUCH DO | |
Bite := Bite XOR 2#_0000_0010; | |
END_FOR | |
300: // NOT BYTE.x | |
FOR i := 0 TO HOW_MUCH DO | |
Bite.2 := NOT Bite.2; | |
END_FOR | |
400: // NOT BIT | |
FOR i := 0 TO HOW_MUCH DO | |
Bang.b1 := NOT Bang.b1; | |
END_FOR | |
500: // NOT BYTE.Enable | |
FOR i := 0 TO HOW_MUCH DO | |
Ind.Enable := NOT Ind.Enable; | |
END_FOR | |
1000: // READ BOOL | |
FOR i := 0 TO HOW_MUCH DO | |
IF Bul THEN | |
; | |
END_IF | |
END_FOR | |
1100: // READ BIT | |
FOR i := 0 TO HOW_MUCH DO | |
IF Bang.b1 THEN | |
; | |
END_IF | |
END_FOR | |
1200: // WRITE BOOL | |
FOR i := 0 TO HOW_MUCH DO | |
Bul := TRUE; | |
END_FOR | |
1300: // WRITE BIT | |
FOR i := 0 TO HOW_MUCH DO | |
Bang.b1 := TRUE; | |
END_FOR | |
END_CASE | |
END_PROGRAM |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment