summaryrefslogtreecommitdiff
path: root/exp/FB_BECKHOFF_EL5101_INC.EXP
diff options
context:
space:
mode:
authorpux <pux@pux.dom>2021-01-07 19:39:17 +0100
committerpux <pux@pux.dom>2021-01-07 19:39:17 +0100
commit39765e002e71a2dd54e932469877acfc1b6fcb67 (patch)
tree83456425ad35e8c47894dee6660bd9ed574ebfdd /exp/FB_BECKHOFF_EL5101_INC.EXP
parentbbbba6c698a73fc1a6bd00f7a07c89ba19ce38c5 (diff)
downloadlib61131aux-master.tar.gz
lib61131aux-master.tar.bz2
lib61131aux-master.zip
add *.exp; (this is redundant information, just to be able to diff later on)HEADmaster
Diffstat (limited to 'exp/FB_BECKHOFF_EL5101_INC.EXP')
-rw-r--r--exp/FB_BECKHOFF_EL5101_INC.EXP62
1 files changed, 62 insertions, 0 deletions
diff --git a/exp/FB_BECKHOFF_EL5101_INC.EXP b/exp/FB_BECKHOFF_EL5101_INC.EXP
new file mode 100644
index 0000000..e262631
--- /dev/null
+++ b/exp/FB_BECKHOFF_EL5101_INC.EXP
@@ -0,0 +1,62 @@
+
+(* @NESTEDCOMMENTS := 'Yes' *)
+(* @PATH := '\/TEMP' *)
+(* @OBJECTFLAGS := '0, 8' *)
+(* @SYMFILEFLAGS := '2048' *)
+FUNCTION_BLOCK FB_BECKHOFF_EL5101_INC
+
+VAR_INPUT
+ E_InfoData_AdsAddr_port AT%I* : INT;
+ E_InfoData_State AT%I* : INT;
+
+ E_CounterValue AT%I* : UINT;
+ UEboReferenzieren : BOOL;
+ UErSkalierung : REAL;
+ UErRefWertMm : REAL;
+END_VAR
+
+VAR_OUTPUT
+ A_SetCounter AT%Q* : BOOL;
+ A_SetCounterValue AT%Q* : UINT;
+ UAboReferenziert : BOOL;
+ UArWert: REAL;
+END_VAR
+
+VAR
+ pfReferenzieren : R_TRIG;
+END_VAR
+
+
+(* @END_DECLARATION := '0' *)
+(***************************************************)
+(** Beckhoff EL5101 Incremental Encoder Interface **)
+(***************************************************)
+
+a_Referenzieren();
+
+UArWert := E_CounterValue / UErSkalierung;
+END_FUNCTION_BLOCK
+ACTION a_Referenzieren:
+pfReferenzieren(clk:=
+ UEboReferenzieren
+ AND E_InfoData_State = 8 (* Op *)
+);
+UEboReferenzieren := FALSE;
+
+
+A_SetCounter := 0;
+(* z.B. RefWertMm = 432
+ Skalierung = 25
+ => 10800 *)
+A_SetCounterValue :=
+ REAL_TO_UINT(UErRefWertMm
+ * UErSkalierung);
+ (* TODO: Andere Typen? *)
+
+
+IF pfReferenzieren.Q THEN
+ A_SetCounter := 1;
+ UAboReferenziert := TRUE;
+END_IF
+END_ACTION
+
in each repos: see "about"-tab (if existing) for more details / README.
mailto contact at omeckman dot net
all timestamps in UTC (German winter time: UTC+01:00, summer time: UTC+02:00)
dark theme is a modded version of: https://gist.github.com/Yoplitein/f4b671a2ec70c9e743fa