Deutsch - Software > easySoft

Wie macht man Stromstoßrelais mit strukturiertem Text (ST)?

(1/2) > >>

Andrus Saar:
Hello

Wie kann ich Stromstoßrelais in strukturiertem Text (ST) implementieren?

Wenn ich zum Beispiel die RECHTS-Taste P03 einmal drücke, wird der Ausgang Q1 eingeschaltet, beim zweiten Drücken wird der Ausgang ausgeschaltet, beim dritten Drücken wird der Ausgang wieder eingeschaltet usw.

Andrus

(übersetzt von DeepL Translate)



weiss_nix:
hi Andrus,
it's very simple ;)

--- Code: ---// rising edge
M100 := I01 and not M101;
M101 := I01;

// impulse switch
Q01 := Q01 xor M100;

--- Ende Code ---

weiss_nix

Andrus Saar:
Hello

Oh, das ist eine wirklich gute und einfache Lösung. Meine ist ein bisschen komplizierter, aber sie funktioniert, wie sie sollte.


--- Code: ---(* 2. Impulse relay logic. The RIGHT button turns output Q2 on or off *)

IF P03 AND NOT M02 THEN  // Initiate impulse relay function - RIGHT button switches memory M3.
    M03 := NOT M03;  // Memory, which is switched on the first time, off the second time, on the third time, etc.
END_IF;

M02 := P03;

Q2 := M03;  // Output Q2 is assigned a value from memory M3

--- Ende Code ---

Andrus

(übersetzt von DeepL Translate)

weiss_nix:
Hi Andrus, if you like very short and crisp ST programming, you can try this code snippet.


--- Code: ---// impulse switch
Q01 := Q01 xor (I01 and not M101);
M101 := I01;

--- Ende Code ---

weiss_nix

ssyn:
 weiss_nix, ;) toll
Can anybody to make it else shorter - in one line?  ;)

Navigation

[0] Themen-Index

[#] Nächste Seite

Zur normalen Ansicht wechseln