Remove RETAIN qualifier for F_TRIG and R_TRIG 'M' variable. This is not following standard, and implicitely consumes a lot of RETAIN memory. User can explicitely qualify R_TRIG of F_TRIG instance as RETAIN if needed.
--- a/lib/C/iec_std_FB.h Mon Jul 06 13:29:08 2020 +0200
+++ b/lib/C/iec_std_FB.h Mon Oct 04 11:29:13 2021 +0200
@@ -565,7 +565,7 @@
__INIT_VAR(data__->ENO,__BOOL_LITERAL(TRUE),retain)
__INIT_VAR(data__->CLK,__BOOL_LITERAL(FALSE),retain)
__INIT_VAR(data__->Q,__BOOL_LITERAL(FALSE),retain)
- __INIT_VAR(data__->M,__BOOL_LITERAL(FALSE),1)
+ __INIT_VAR(data__->M,__BOOL_LITERAL(FALSE),retain)
}
// Code part
@@ -598,7 +598,7 @@
__INIT_VAR(data__->ENO,__BOOL_LITERAL(TRUE),retain)
__INIT_VAR(data__->CLK,__BOOL_LITERAL(FALSE),retain)
__INIT_VAR(data__->Q,__BOOL_LITERAL(FALSE),retain)
- __INIT_VAR(data__->M,__BOOL_LITERAL(FALSE),1)
+ __INIT_VAR(data__->M,__BOOL_LITERAL(FALSE),retain)
}
// Code part
--- a/lib/edge_detection.txt Mon Jul 06 13:29:08 2020 +0200
+++ b/lib/edge_detection.txt Mon Oct 04 11:29:13 2021 +0200
@@ -20,7 +20,7 @@
FUNCTION_BLOCK R_TRIG
VAR_INPUT CLK: BOOL; END_VAR
VAR_OUTPUT Q: BOOL; END_VAR
- VAR RETAIN M: BOOL; END_VAR
+ VAR M: BOOL; END_VAR
Q := CLK AND NOT M;
M := CLK;
END_FUNCTION_BLOCK
@@ -28,7 +28,7 @@
FUNCTION_BLOCK F_TRIG
VAR_INPUT CLK: BOOL; END_VAR
VAR_OUTPUT Q: BOOL; END_VAR
- VAR RETAIN M: BOOL; END_VAR
+ VAR M: BOOL; END_VAR
Q := NOT CLK AND NOT M;
M := NOT CLK;
END_FUNCTION_BLOCK