User Tools

Site Tools


en-us_commands:reference:igettime

This is an old revision of the document!


IgetTime()

IgetTime() returns the current elapsed time of the specified timer.

IgetTime command operation flow

unsigned long IgetTime(uint8_t timer_id)

Commands

Command Arguments Return Value Operation
IgetTime(timer_id) uint8_t timer_id — Timer number. Supports 0 ~ 255 unsigned long Returns the current elapsed time of the specified timer.

Example

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);

Precautions

  • Timer interrupt callbacks run inside an ISR. For safety, change only flags in the callback and perform actual control processing in loop().
  • Do not use slow or interrupt-dependent code such as delay(), Serial, I2C or SPI in callbacks.
  • Normally, call ImodbusRTU() repeatedly in loop(). Call it from a timer interrupt with a sufficient interval only when long delay() calls or debug output slow down loop().
  • Do not use the default ItimerSet() together with tone() using Timer2 or analogWrite() on Timer2 PWM pins.
  • Explicitly using Timer1, Timer3, Timer4 or Timer5 may conflict with PWM, analog output or high-speed counter functions using that timer.
  • Configure only one Itimer callback per hardware timer.
  • Defining an ISR for the same timer directly in the sketch may conflict with Itimer operation.
  • ItimerStopAll() stops only hardware interrupt timers. It does not reset PLC-style timer states such as Iton, Itof or Itmr.

← Built-in Command List

en-us_commands/reference/igettime.1788785567.txt.gz · Last modified: by 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki