User Tools

Site Tools


en-us_commands:counter_buffer

This is an old revision of the document!


Counters and FIFO/FILO

Command Description
Ictu(id, CU, RESET, PV) Counts CU rising edges and turns ON at PV.
Ictd(id, CD, LOAD, PV) Decrements on each CD rising edge after LOAD.
Ictud(id, CU, CD, RESET, LOAD, PV) Handles increment and decrement together.
IgetCount(id), IsetCount(id, value) Reads or changes the current value.
IctudDownState(id) Returns the lower-limit completion state of the Up/Down counter.
FIFO(id, IN, OUT, input, output, size, reset) Retrieves the first stored 16-bit data first.
FILO(id, IN, OUT, input, output, size, reset) Retrieves the last stored 16-bit data first.
void loop() {
  bool countDone = Ictu(0, digitalRead(0), false, 10);
  int32_t countValue = IgetCount(0);
}

Command Prototypes

Return Type Command Prototype
bool Ictu(uint8_t counter_id, bool CU, bool RESET, int32_t PV)
bool Ictd(uint8_t counter_id, bool CD, bool LOAD, int32_t PV)
bool Ictud(uint8_t counter_id, bool CU, bool CD, bool RESET, bool LOAD, int32_t PV)
int32_t IgetCount(uint8_t counter_id)
void IsetCount(uint8_t counter_id, int32_t value)
bool IctudDownState(uint8_t counter_id)
bool FIFO(uint8_t fifo_id, bool IN, bool OUT, uint16_t input, uint16_t &output, uint8_t size, bool reset = false)
bool FILO(uint8_t filo_id, bool IN, bool OUT, uint16_t input, uint16_t &output, uint8_t size, bool reset = false)

IN, OUT, CU and CD act on rising edges. Use a unique id for each counter or buffer, and keep size to the required minimum.

← Built-in Command List

en-us_commands/counter_buffer.1788785564.txt.gz · Last modified: by 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki