easy-forum

English Support - Software => easySoft => Thema gestartet von: Andrus Saar am Februar 15, 2024, 21:32:39 Nachmittag

Titel: Demo program - set, reset, toggle, edge detection
Beitrag von: Andrus Saar am Februar 15, 2024, 21:32:39 Nachmittag
Hello everyone

I'm quietly practicing programming in ST.

I'm quite at the beginning, only a few months of practice.

I made a demo program with set and reset, pulse relay function and edge detection.

Program description and code in .zip file.

Andrus
Titel: Antw:Demo program - set, reset, toggle, edge detection
Beitrag von: Andrus Saar am Februar 16, 2024, 23:29:48 Nachmittag
Question:


(* 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;  // Impulse relay function termination - button RIGHT affects memory M2.


Is there any way to make this function shorter or easier?

Andrus
Titel: Antw:Demo program - set, reset, toggle, edge detection
Beitrag von: weiss_nix am Februar 27, 2024, 08:00:05 Vormittag
Hi Andrus,
I think your question is answered here! (https://easy-forum.net/index.php?topic=8773.msg37967#msg37967)

weiss_nix
Titel: Antw:Demo program - set, reset, toggle, edge detection
Beitrag von: Andrus Saar am März 02, 2024, 07:11:20 Vormittag
Hello

New version of the program, modified according to Weiss_nix instructions.

Andrus