Hello again
Slightly revised weekly programme.
Written in ST. With comments.
Andrus
(* Weekly timer demonstration programme *)
(* Filename is "Weekly timer demo v2 (ST).e70" , written with Eaton easySoft v7.41 *)
(* The program tested on Eaton easyE4 (E4-DC-12TC1, with firmware 1.42) *)
(* Andrus Saar , 16.03.2024 , written in Estonia. Comments have been translated by DeepL Translator *)
(* The memories MB1 ... MB20 are set to retentivity so that the values are retained in the event of a power failure *)
(* Beginning of the programme *)
(* Real-time clock *)
RC01 (
EN := ,
DT => ,
E1 => ,
YY => , // Year (two last digits 00 ... 99).
MM => , // Month (1 ... 12).
DD => , // Day (1 ... 31).
WD => , // Weekday (0 ... 6 , where 0 - Sunday, 1 - Monday, 2 - Tuesday, 3 - Wednesday etc.).
HR => MB1, // Hours (0 ... 23), written in MB1.
MN => MB2, // Minutes (0 ... 59), written in MB2.
SC => // Seconds (0 ... 59).
);
(* M49 to M55 is the day of the week, selected from the display *)
M56 := M49 AND (RC01WD = 1); // Monday.
M57 := M50 AND (RC01WD = 2); // Tuesday.
M58 := M51 AND (RC01WD = 3); // Wednesday.
M59 := M52 AND (RC01WD = 4); // Thursday.
M60 := M53 AND (RC01WD = 5); // Friday.
M61 := M54 AND (RC01WD = 6); // Saturday.
M62 := M55 AND (RC01WD = 0); // Sunday.
M63 := M56 OR M57 OR M58 OR M59 OR M60 OR M61 OR M62;
(* Minutes calculated from the hours and minutes of the real time clock *)
MD3 := MB1 * 60 + MB2; // result is 0 ... 1439.
(* Comparing real time and switching time, except days of the week *)
M64 := ( MD3 >= MD4 ) AND ( MD3 < MD5 );
(* Output Q1 is ON, if day of the week and time is match *)
Q01 := M63 AND M64;
// LE05 := Q01; // You can use the green backlight if the controller firmware is 1.30 or later.
(* If the switch-on time are set more than 1440 (24 hours and 00 minutes) then switch-on time will be set to 1440 *)
IF MD4 > 1440 THEN
MD4 := 1440;
END_IF;
(* If the switch-off time are set more than 1440 (24 hours and 00 minutes) then switch-off time will be set to 1440 *)
IF MD5 > 1440 THEN
MD5 := 1440;
END_IF;
(* If the switch-on time is greater than the switch-off time, the switch-off time is set equal to the switch-on time.
If both times are the same (e.g. 10:00 and 10:00) then no switching will actually take place *)
IF MD4 > MD5 THEN
MD5 := MD4;
END_IF;
(* On-delay timer for text displays *)
T01 (
EN := TRUE,
RE := ,
ST := ,
I1 := T#3000ms,
I2 := ,
Q1 => ,
QV =>
);
(* Display showing program and author name, version number and creation time at program start for 3 seconds *)
D01 (
EN := NOT T01Q1,
AI := ,
Q1 => ,
AO =>
);
(* Display showing real time clock, day of the week selections, switch-on time, switch-off time and output status *)
D02 (
EN := T01Q1,
AI := ,
Q1 => ,
AO =>
);
(* End of the programme *)