diff options
author | pux <pux@pux.dom> | 2021-01-07 19:39:17 +0100 |
---|---|---|
committer | pux <pux@pux.dom> | 2021-01-07 19:39:17 +0100 |
commit | 39765e002e71a2dd54e932469877acfc1b6fcb67 (patch) | |
tree | 83456425ad35e8c47894dee6660bd9ed574ebfdd /exp/FB_DI.EXP | |
parent | bbbba6c698a73fc1a6bd00f7a07c89ba19ce38c5 (diff) | |
download | lib61131aux-39765e002e71a2dd54e932469877acfc1b6fcb67.tar.gz lib61131aux-39765e002e71a2dd54e932469877acfc1b6fcb67.tar.bz2 lib61131aux-39765e002e71a2dd54e932469877acfc1b6fcb67.zip |
Diffstat (limited to 'exp/FB_DI.EXP')
-rw-r--r-- | exp/FB_DI.EXP | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/exp/FB_DI.EXP b/exp/FB_DI.EXP new file mode 100644 index 0000000..5bead42 --- /dev/null +++ b/exp/FB_DI.EXP @@ -0,0 +1,68 @@ +
+(* @NESTEDCOMMENTS := 'Yes' *)
+(* @PATH := '\/TEMP' *)
+(* @OBJECTFLAGS := '0, 8' *)
+(* @SYMFILEFLAGS := '2048' *)
+FUNCTION_BLOCK FB_DI
+
+VAR_INPUT
+ E_INPUT AT%I* : BOOL;
+ UEboDisable : BOOL;
+ UEboResetFlankenZaehler: BOOL;
+ UEtEntprellZeit: TIME := t#50ms;
+ UEboProtokolle : BOOL;
+ UEsName: STRING := 'unbenannt';
+END_VAR
+
+VAR_OUTPUT
+ UAboInputPosFlanke: BOOL;
+ UAboInputEntprellt: BOOL;
+ UAboInput: BOOL;
+ UAboInputNegFlanke: BOOL;
+END_VAR
+
+VAR
+ pfInput: R_TRIG;
+ dwPosFlanken: DWORD;
+ tonInput: TON;
+ nfInput: F_TRIG;
+ dwNegFlanken: DWORD;
+ sTemp: STRING;
+END_VAR
+(* @END_DECLARATION := '0' *)
+(* Digital Input FB *)
+
+pfInput(clk:=E_INPUT AND NOT UEboDisable);
+nfInput(clk:=E_INPUT AND NOT UEboDisable);
+
+IF pfInput.Q THEN
+ dwPosFlanken := dwPosFlanken + 1;
+(* IF UEboProtokolle THEN
+ fProtokoll(1, CONCAT('pfInput: ', UEsName), 0);
+ END_IF*)
+END_IF
+
+IF nfInput.Q THEN
+ dwNegFlanken := dwNegFlanken + 1;
+(* IF UEboProtokolle THEN
+ fProtokoll(1, CONCAT('nfInput: ', UEsName), 0);
+ END_IF*)
+END_IF
+
+IF UEboResetFlankenZaehler THEN
+ UEboResetFlankenZaehler := FALSE;
+ dwPosFlanken := 0;
+ dwNegFlanken := 0;
+END_IF
+
+(************************************)
+
+tonInput(in:=E_INPUT AND NOT UEboDisable, pt:=UEtEntprellZeit);
+
+(************************************)
+
+UAboInput := E_INPUT AND NOT UEboDisable;
+UAboInputPosFlanke := pfInput.Q;
+UAboInputNegFlanke := nfInput.Q;
+UAboInputEntprellt := tonInput.Q;
+END_FUNCTION_BLOCK
|