Subscribe to:
Post Comments (Atom)
Aim of this blog is to share experiences and knowledge about the MGCplus amplifier system from HBM (Hottinger Baldwin Messtechnik). HBM delivers components for the complete measurement chain: Sensors (Transducers), Instrumentation, Amplifiers, Data Acquisition Systems, Software, Calibration, Service and Support.
2 comments:
Hi, are there anywhere the CoDeSys programs for ML70 or ML70B available for download ?
ML70(B) can be used for many applications. Below there is source text representing export code from codesys. Here you can perform fast online averaging (not only for ML70).
(* @PATH := '\/specfun\/filter\/average' *)
(* @SYMFILEFLAGS := '0' *)
FUNCTION_BLOCK average_real (* Online average calculation over N values *)
VAR_INPUT (* IN : signal of type REAL *)
IN: REAL; (* N : number of values to consider (INT) *)
N: INT; (* 2 <= N <=100 *)
reset: BOOL; (* reset : When TRUE, output OUT is set to zero *)
END_VAR (* and "history buffer is cleared *)
VAR_OUTPUT (* OUT : result is average over history *)
OUT: REAL;
END_VAR
VAR
a: ARRAY [0..99] OF REAL;
k: INT;
p: INT;
summe: REAL;
END_VAR
(* @END_DECLARATION := '0' *)
IF N>100 THEN
N:=100;
ELSE
IF N<2 THEN
N:=2;
END_IF;
END_IF;
IF NOT reset THEN
summe:=summe-a[k];
a[k]:=IN;
summe:=summe+IN;
k:=k+1;
IF k>=N THEN
k:=0;
END_IF
OUT:=summe/INT_TO_REAL(N);
ELSE
OUT:=0;
summe:=0;
FOR p:=0 TO N-1 DO;
a[p]:=0;
END_FOR;
END_IF;
END_FUNCTION_BLOCK
Post a Comment