Sample Program 5 (Write Filter Coefficients) - Beckhoff EPP3504-0023 Short Manual

4-channel measuring bridge,(sg) full/half/quarter bridge, 24 bit, 10 ksps
Hide thumbs Also See for EPP3504-0023:
Table of Contents

Advertisement

Commissioning
   nMinValue                     : DINT := 7812500;
   nMaxValue                     : DINT := -7812500;
   nYvalue                       : DINT;
   tRepeatTimerValue             : TIME := T#51MS;
   aLUT                          : ARRAY[0..99] OF DINT;
END_VAR
Execution part:
// Example program 4:
// ################# Recording of 50 sample points: #################
// a) Determination of min./max. values (corresponding to the value range of the sensor)
tp_timer(IN:=bGetMinMax, PT:=T#2.51S); // Periodic duration of ramp (+reserve)
IF tp_timer.Q THEN
   nMinValue := MIN(nPAISampleIn, nMinValue);
   nMaxValue := MAX(nPAISampleIn, nMaxValue);
END_IF
// b) Recording of values: Start
r_trigStartRecord(CLK:=bStartRecord);
IF r_trigStartRecord.Q THEN
   nX := 0;
   memset(ADR(aLUT), 0 , 100);
   bRecordLUT := TRUE;
END_IF
ton_timer();
IF bRecordLUT OR ton_timer.Q THEN
   bRecordLUT := FALSE;
   ton_timer(IN:=FALSE);
   IF(nX < nEndX) THEN
      // b.1) Record of values:
      aValues[nX] := nPAISampleIn;
      nX := nX + 1;
      ton_timer(IN:=TRUE, PT:=tRepeatTimerValue); // T=2.5s/49 = 51ms
   ELSE
      // b.2) Recording end:
      // Create linearized values:
      nYstepValue := (nMaxValue - nMinValue) / nEndX; // Y steps
      nYvalue := aValues[0];  // Common start value of the LUT
      FOR nX:=0 TO nEndX DO
         // Create LUT (X = actual values, Y = target values):
         aLUT[nX*2] := aValues[nX]; // X value
         aLUT[nX*2+1] := nYvalue;   // Y value
         // next Y value of the LUT (make a "straight"):
         nYvalue := nYvalue + nYstepValue; // f(x) = b+x
END_FOR
   END_IF
END_IF
4.3.4
Sample program 5 (write filter coefficients)
Download TwinCAT 3 project: https://infosys.beckhoff.com/content/1033/epp3504/Resources/
2152672011/.zip
94
Version: 1.2
EPP3504-0023

Advertisement

Table of Contents
loading

Table of Contents