Thursday, April 13, 2006


Acquiring GPS Data with MGCplus: No problem with the soft PLC ML70. Ready made CODESYS programs - free of charge - are available for different tasks in different applications. Posted by Picasa

2 comments:

  1. Hi, are there anywhere the CoDeSys programs for ML70 or ML70B available for download ?

    ReplyDelete
  2. 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

    ReplyDelete