Herunterladen Inhalt Inhalt Diese Seite drucken

Beckhoff EL2212 Dokumentation Seite 185

2-kanal-digital-ausgangsklemme 24...72 v dc mit übererregung, multi-timestamp
Inhaltsverzeichnis

Werbung

Inbetriebnahme
   aQE_State AT%Q* : ARRAY[0..9] OF BOOL;
   // Outputvariables to reset the output-buffers of EL2212
   bOutputBufReset AT%Q* : BOOL;
   // Real number of fixed State/Time-Events as a Task for EL2212
   nNoOfOutputEvents AT%Q* : USINT;
   // Start-Event to trigger beginning of task scheduling
   nOutputOrderCnt AT%Q* : USINT;
END_VAR
VAR
   aSwitchTime : ARRAY[0..9] OF UDINT:=
   // All 10 time offsets in ms allocated to the 10 states:
    [
      100, 200, 250, 100, 150, 200, 100, 150, 200, 150
   ];
   nState : UINT:=0; // Use for "CASE .. OF" statement
   nShortTime : ULINT; // Timevalue of current DC time/ lower 32 Bit only
   nCurrentTime : ULINT; // Current DC-Time of the PLC-Task
   bStateValue : BOOL; // Variable to set a toggled state of a task-event
   nScheduleNo: INT; // Consists No of respective state/time pair
                     // of a Switch-Task
END_VAR
Programmcode:
// Example program 2: 10x Multi-Timestamp for EL2212
nCurrentTime := F_GetCurDcTaskTime64(); // Get current DC-Time (Task-Related)
// Overtake feedback of EL2212 to any output terminal
// for using as trigger / reference signal:
bOutputReference := bOutputState;
CASE nState OF
// ====================== Do some initializations here: ============================
0:
// Reset ouput buffer of the terminal EL2212
   bOutputBufReset := TRUE;
   nState := nState + 1;// Go to next state
1:
   bOutputBufReset := FALSE;
   nState := nState + 1; // Go to next state
2:
// Wait for external start-event by user (e.g. ext. switch)
   IF bEnable THEN
      nState := 10; // Go to next state and set events
   END_IF
// =================================================================================
// ============ Now fill up all state/time pairs for the four channels =============
10:
// Last tasks already executed?
   IF bReadyToActivate THEN
      bStateValue:=1;
      // Set first state level ('1')
      aQE_State[0] := bStateValue;
      // Cut 64 Bit time value to 32 Bit
      nShortTime := nCurrentTime AND 16#FFFFFFFF;
      // Set first time value (duration for "save" begin)
EL2212
Version: 2.3
185

Werbung

Inhaltsverzeichnis
loading

Inhaltsverzeichnis