Beckhoff EPP3504-0023 Short Manual page 87

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
   nSTATE_SCALE_OFFSET   :INT := 0;
   bScaleOffsetStart     :BOOL := FALSE;
   bScaleOffsetDone      :BOOL := FALSE;
   fOffsetDeviationVal   :REAL;
   nOFFSET_MIN_VAL_REF   :WORD := 200;  // Max. limit value for offset
   // Variables used for gain scaling:
   nSTATE_SCALE_GAIN     :INT := 0;
   bScaleGainStart       :BOOL := FALSE;
   bScaleGainDone        :BOOL := FALSE;
   nPRESET_MAX_VAL       :REAL := 3000000; // Target amplitude value
   // ===============================================
   // Variables for evaluating of gain and offset:
   nOffset               :REAL := 0; // Offset value
   nGain                 :REAL := 1; // Gain value
   nScaledSampleVal      :REAL;
   nDINT_Value           :DINT;
   fb_trig_bEnable       :R_TRIG; // Trigger FB for Enable
   bError                :BOOL := FALSE; // Evaluate..
END_VAR
Execution part:
// THIS CODE IS ONLY AN EXAMPLE - YOU HAVE TO CHECK APTITUDE FOR YOUR APPLICATION
// Example program 1 and 2 program code:
// =====================================
// 1. PAI setting of 0x80n0:2E must be "Extended Range" at first
// 2. When writing of scaling values were done, switch to "Linear"
// Calculation of the temporary value (..and use for ScopeView to check)
nScaledSampleVal := nOffset + nGain * DINT_TO_REAL(nPAI_Sample);
// Main-State Procedure:
CASE nMainCal_State OF
   0:
      fb_trig_bEnable(CLK:=(bEnable AND NOT bError));
      IF fb_trig_bEnable.Q THEN // Poll switch or button
         // Initialize temporary offset and gain values:
         nOffset:= 0;
         nGain  := 1;
         bScaleOffsetStart := bScalingOrder;
         bScaleGainStart   := NOT bScalingOrder;
         fb_get_min_max.nMinFreqInput := fMinFrequencyIn;
         nMainCal_State := 10; // Start
      END_IF
   10:
      IF (bScaleGainDone AND NOT bScalingOrder)
        OR (bScaleOffsetDone AND bScalingOrder) THEN
         bScaleOffsetStart := NOT bScalingOrder;
         bScaleGainStart   := bScalingOrder;
         nMainCal_State := nMainCal_State + 10;
      END_IF
   20:
      IF bScaleGainDone AND bScaleOffsetDone THEN
         nMainCal_State :=0; // All done, initalization for next start
EPP3504-0023
Version: 1.2
87

Advertisement

Table of Contents
loading

Table of Contents