eTON does not clear on IN input deactivation
Home › Forum › Programmazione IEC 61131 (LogicLab) › eTON does not clear on IN input deactivation
- Questo topic ha 4 risposte, 2 partecipanti ed è stato aggiornato l'ultima volta 9 anni, 8 mesi fa da
Sergio Bertana.
-
AutorePost
-
Marzo 3, 2016 alle 12:56 am #35961
Gregory
PartecipanteeTON is acting like a retentive time by remembering ET from on/off/on activation of IN. Need a NON-RETENTIVE TIMER or eTON needs to be fixed to match documentation.
Marzo 3, 2016 alle 7:10 am #39427Sergio Bertana
Amministratore del forumThe behaviour of eTON is been treated in this topic, unfortunately is an Italian topic. The eTON Q output works according the On-delay (TON) timing IEC-61131 raccomandation (Here the logic diagram) the only difference is in the ET output that it’s not reset, but the time is not remembered at the new IN activation. When the IN is been deactivated it stops the count (ET remains at its value) but when the IN is activated again the ET is reset and starts to count from 0. Here the eTON FB source code, on red the modify to be written to match the IEC raccomandation.
(* If the IN is not active resets the ouput and save time. *)
IF NOT(IN) THEN
ET:=0; (* Executing time (mS) to be inserted to exactly match the IEC raccomandation *)
TimeBf:=SysTime; (* Time buffer *)
Q:=FALSE; (* Delayed output *)
RETURN;
END_IF;(* IN active, and if Q is active checks if PT is greather than ET and resets Q. *)
IF (Q) THEN
IF (PT > ET) THEN Q:=FALSE; END_IF;
RETURN;
END_IF;(* Checks if time is been elapsed. *)
ET:=SysTime-TimeBf; (* Executing time (mS) *)
IF (ET >= PT) THEN
Q:=TRUE; (* Delayed output *)
ET:=PT; (* Executing time (mS) *)
END_IF;To help you, here the print of a sample project with the eTON source code, so you can modify it according the IEC raccomandations.
Marzo 3, 2016 alle 8:03 am #39428Sergio Bertana
Amministratore del forumThe new eLLabStdLib_B200 library with the eTON FB modified according the IEC raccomandations is available for the download from the LogicLab page.
Marzo 3, 2016 alle 3:25 pm #39430Gregory
PartecipanteThanks for your quick response and solution.
Where can I find documentation for internal functions such as SysTime? I thought I had seen this documentation somewhere (in Italian) but I can’t seem to find it anywhere now.
Marzo 4, 2016 alle 7:07 am #39431Sergio Bertana
Amministratore del forumThe forum has been created to support customers in using our products and we try to give our best effort in quickly answer.
About the SysTime it is a global variable, there are many others global variables, are all explained in the IEC 61131-3 programming Manual (Refer to the chapter 4, System variables).
Shortly, the SysTime is a UDINT variable that automatically increment each 1 mS, reached the maximum the value is reinitialized. Comparing its actual value with a saved value, it’s possible to generate or measure delay times. If more precision is required the SysGetSysTime, get system time function must be used. It returns a UDINT variable that automatically increment each 1 uS, reached the maximum the value is reinitialized. Here a sample program that calculates the time the Di00 on CPU module remains active.
IF (%IX255.0 <> Pulse) THEN
Pulse:=%IX255.0; (* Input pulse *)IF (Pulse) THEN
TimeBf:=SysGetSysTime(TRUE); (* Time reference (uS) *)
ELSE
OnTimeCalc:=SysGetSysTime(TRUE)-TimeBf; (* On time calculation (uS) *)
END_IF;
END_IF;Here the InputOnTime project printout and project download.
-
AutorePost
- Devi essere connesso per rispondere a questo topic.