User Tools

Site Tools


en-us_commands:plc_timer

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

en-us_commands:plc_timer [2026/09/07 21:52] – 만듦 - 바깥 편집 127.0.0.1en-us_commands:plc_timer [2026/09/12 23:27] (current) – 바깥 편집 127.0.0.1
Line 1: Line 1:
-====== PLC-Style Timers ======+====== PLC timers ======
  
-^ Command ^ Operation ^ +Select a delay, pulse, or accumulated-time function and inspect its current state.
-| ''Iton(idstate, ms)'' | Turns the output ON when the input has remained ON for the preset time. | +
-| ''Itof(id, state, ms)'' | Turns the output OFF after the preset time has elapsed since the input turned OFF. | +
-| ''Itpl(id, state, ms)'' | Outputs for the preset time starting at the input rising edge. | +
-| ''Itmon(id, state, ms)'' | A monostable pulse that is not extended by another input during execution. | +
-| ''Itmr(idstate, ms, reset)'' | Accumulates ON time and clears it with ''reset''. | +
-| ''IgetTime(id)'' | Returns the timer's elapsed time. | +
-| ''IgetState(id)'' | Returns the timer's output state. |+
  
-<code cpp> +===== Timers =====
-void loop() { +
-  bool run Ibounce(0, 30); +
-  digitalWrite(64, Iton(0, run, 1000)); +
-+
-</code>+
  
-===== Command Prototypes =====+  * [[:en-us_commands:reference:iton|Iton()]] — (On Delay Timer) Returns ''true'' only after the condition has remained ON for a specified time. 
 +  * [[:en-us_commands:reference:itof|Itof()]] — (Off Delay Timer) Returns ''false'' after the specified time has elapsed since the condition turned OFF. 
 +  * [[:en-us_commands:reference:itpl|Itpl()]] — (Pulse Timer) Returns ''true'' for the preset time starting when the condition turns ON. 
 +  * [[:en-us_commands:reference:itmon|Itmon()]] — (Monostable Timer) outputs a pulse whose duration is not extended by another input during operation. 
 +  * [[:en-us_commands:reference:itmr|Itmr()]] — (Retentive Timer) accumulates the time the condition is ON and clears it with the Reset input.
  
-^ Return Type ^ Command Prototype ^ +===== Timer State =====
-| ''bool'' | ''Iton(uint8_t timer_id, bool state, unsigned long delayTime)''+
-| ''bool'' | ''Itof(uint8_t timer_id, bool state, unsigned long delayTime)''+
-| ''bool'' | ''Itpl(uint8_t timer_id, bool state, unsigned long delayTime)''+
-| ''bool'' | ''Itmon(uint8_t timer_id, bool state, unsigned long delayTime)''+
-| ''bool'' | ''Itmr(uint8_t timer_id, bool state, unsigned long delayTime, bool reset false)''+
-| ''unsigned long'' | ''IgetTime(uint8_t timer_id)''+
-| ''bool'' | ''IgetState(uint8_t timer_id)'' |+
  
-These commands do not pause the programCall them on every ''loop()'' iteration and use a unique ''id'' for each timer.+  * [[:en-us_commands:reference:igettime|IgetTime()]] — Returns the current elapsed time of the specified timer. 
 +  * [[:en-us_commands:reference:igetstate|IgetState()]] — Returns the current output state of the specified timer.
  
-[[:en-us_commands:builtin|← Built-in Command List]]+[[:en-us_commands:builtin|← Built-in function list]]
  
en-us_commands/plc_timer.1788785565.txt.gz · Last modified: by 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki