Herunterladen Inhalt Inhalt Diese Seite drucken

Beispielprogramm 8 (Diagnose Nachrichten) - Beckhoff ELM3-Serie Kurz-Dokumentation

Messtechnik-klemmen
Inhaltsverzeichnis

Werbung

Inbetriebnahme
         nDY := aOVS_SampleSets[i+1] - aOVS_SampleSets[i];
         sVal := DINT_TO_LREAL(nDY)/nOVSTimeInterval_ns;
         // Get the time (difference) from the left side element start to the desired time point:
         nDX := tDecVar_InTaskCycle
                 - TRUNC_INT(tDecVar_InTaskCycle/nOVSTimeInterval_ns)
                 * UDINT_TO_LREAL(nOVSTimeInterval_ns);
         // Calc timestamp
         tVarDecResult := nDX + ULINT_TO_LREAL(nOVS_CycleCount);
         // Calc new value:
         nVarDecResult :=
                  LREAL_TO_DINT(DINT_TO_LREAL(aOVS_SampleSets[i]) + sVal * nDX);
         // next decimation time step
         tDecVar_InTaskCycle := tDecVar_InTaskCycle + nDecTimeInterval_ns;
         tDecVar_InTaskCycle := tDecVar_InTaskCycle
                 - INT_TO_UDINT(TRUNC_INT(tDecVar_InTaskCycle/nTaskCycle_ns))
                 * nTaskCycle_ns;
      END_IF
      // Fill timestamp and new value allocated to the field element of its timestamp
      aVarDecResult_TS[i] := tVarDecResult;
      aVarDecResult[i] := nVarDecResult;
      // For visualization of the original input:
      aOVS_Samples[i] := aOVS_SampleSets[i];
      aOVS_Samples_TS[i] := nOVS_CycleCount;
      // Count the task cycle timestamp
      nOVS_CycleCount := nOVS_CycleCount + nOVSTimeInterval_ns;
   END_FOR
END_IF
IF nOVS_CycleCount = 1000000000 THEN
   bEnable := FALSE;// Stop after 1s just for recording
   IF NOT bEnable THEN
      bEnable := TRUE; // OVS‑Samples transferred complete into both array sets
   END_IF
END_IF
4.3.7

Beispielprogramm 8 (Diagnose Nachrichten)

Download TwinCAT 3 Projekt: https://infosys.beckhoff.com/content/1031/elm3xxx/
Resources/4279234443.zip
Hinweis zum Laden des Programms: Vorbereitungen zum Starten des Beispielprogramms (tpzip - Datei/
TwinCAT 3) [} 686]
Programmbeschreibung/ Funktion
Das Beispielprogramm liest einige CoE Objekte aus der Klemme; dabei auch 0x10F3 „Diagnosis History"
[} 527] in der anwenderseitig verwertbare Diagnosedaten enthalten sind:
Diagnose Nachricht Nr.01...16 (0x10F3:06...0x10F3:15). Aufbau einer Nachricht (Little-Endian beachten):
[dddd cccc ffff mmmm tttttttttttttttt pppp
 kk
]
(i)
(i)
708
Version: 2.11
ELM3xxx

Werbung

Inhaltsverzeichnis
loading

Inhaltsverzeichnis