Questo blocco funzione a differenza del FB BLINK, esegue la temporizzazione di un ciclo On/Off con tempi random di On e di Off definibili tra valori minimo e massimo. Il massimo valore di tempo gestito è di oltre 1193 ore. Impostando 0 nei tempi Min e Max si ottiene una uscita impulsiva (Un loop) sulla relativa temporizzazione.
Attivando il comando Enable l’uscita Out esegue un lampeggio On/Off con tempi random compresi tra i valori minimo e massimo definiti. Disabilitando l’ingresso l’uscita Out si disattiva. In Delay è ritornato il valore di ritardo attualmente attivo, in Time è ritornato il countdown del tempo.
Descrizione
Enable (BOOL) Abilitazione blocco funzione, attivandolo viene gestito il lampeggio dell’uscita Out. Disattivandolo l’uscita viene resettata.
MinOffTime (UDINT) Valore minimo di tempo in cui l’uscita rimane nello stato logico low, espresso in mS.
MaxOffTime (UDINT) Valore massimo di tempo in cui l’uscita rimane nello stato logico low, espresso in mS.
MinOnTime (UDINT) Valore minimo di tempo in cui l’uscita rimane nello stato logico high, espresso in mS.
MaxOnTime (UDINT) Valore massimo di tempo in cui l’uscita rimane nello stato logico high, espresso in mS.
Out (BOOL) Stato On/Off in uscita.
Delay (UDINT) Valore di tempo attualmente in temporizzazione, espresso in mS.

Esempi
Come utilizzare gli esempi.
Viene impostato un lampeggio con tempi random di Off compresi tra 1 e 3 secondi, e tempi random di On compresi tra 500mS e 2 secondi.
LogicLab (Ptp114, ST_OnOffCycle_v1)
PROGRAM ST_OnOffCycle_v1
VAR
Lamp : BOOL; (* Lamp output *)
VarOut : UDINT; (* Variable output *)
Blink : OnOffCycle_v1; (* On/Off cycle FB *)
END_VAR
// *****************************************************************************
// PROGRAM "ST_OnOffCycle_v1"
// *****************************************************************************
// Lamp blinks staying off for a random time between 1 to 3 S and on for a
// random time between 500 mS to 2 S.
// -----------------------------------------------------------------------------
// -------------------------------------------------------------------------
// INITIALIZATION
// -------------------------------------------------------------------------
IF (SysFirstLoop) THEN
Blink.MinOffTime:=1000; //Set the minimum off time
Blink.MaxOffTime:=3000; //Set the maximum off time
Blink.MinOnTime:=500; //Set the minimum on time
Blink.MaxOnTime:=2000; //Set the maximum on time
END_IF;
// -------------------------------------------------------------------------
// LAMP BLINKING
// -------------------------------------------------------------------------
Blink(Enable:=TRUE); //Call On/Off cycle FB
VarOut:=Blink.Delay; //Delay time is copied to variable
Lamp:=Blink.Out; //Lamp output
// [End of file]
LogicLab (Ptp114, IL_OnOffCycle_v1)
PROGRAM IL_OnOffCycle_v1
VAR
Lamp : BOOL; (* Lamp output *)
VarOut : UDINT; (* Variable output *)
Blink : OnOffCycle_v1; (* On/Off cycle FB *)
END_VAR
(* ************************************************************************** *)
(* PROGRAM "IL_OnOffCycle_v1" *)
(* ************************************************************************** *)
(* Lamp blinks staying off for a random time between 1 to 3 S and on for a *)
(* random time between 500 mS to 2 S. *)
(* -------------------------------------------------------------------------- *)
(* ---------------------------------------------------------------------- *)
(* INITIALIZATION *)
(* ---------------------------------------------------------------------- *)
LD SysFirstLoop
JMPCN IEnd
LD 1000
ST Blink.MinOffTime (* Set the minimum off time *)
LD 3000
ST Blink.MaxOffTime (* Set the maximum off time *)
LD 500
ST Blink.MinOnTime (* Set the minimum on time *)
LD 2000
ST Blink.MaxOnTime (* Set the maximum on time *)
IEnd:
(* ---------------------------------------------------------------------- *)
(* LAMP BLINKING *)
(* ---------------------------------------------------------------------- *)
LD TRUE
ST Blink.Enable (* Transfer the digital input to Enable input *)
CAL Blink (* Call On/Off cycle FB *)
LD Blink.Delay
ST VarOut (* Delay time is copied to variable *)
LD Blink.Out
ST Lamp (* Lamp output *)
(* [End of file] *)