blob: e262631ab7f4080296a888264dcb535b12c03e2e (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
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.
dark theme is a modded version of: https://gist.github.com/Yoplitein/f4b671a2ec70c9e743fa