User Tools

Site Tools


en-us_commands:counter_buffer

Differences

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

Link to this comparison view

en-us_commands:counter_buffer [2026/09/07 21:52] – 만듦 - 바깥 편집 127.0.0.1en-us_commands:counter_buffer [2026/09/12 23:27] (current) – 바깥 편집 127.0.0.1
Line 1: Line 1:
-====== Counters and FIFO/FILO ======+====== Counters and data buffers ======
  
-^ Command ^ Description ^ +Count input events or store and retrieve 16-bit values in order.
-| ''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|+
  
-<code cpp> +===== Counters =====
-void loop() { +
-  bool countDone Ictu(0, digitalRead(0), false, 10); +
-  int32_t countValue IgetCount(0); +
-+
-</code>+
  
-===== Command Prototypes =====+  * [[:en-us_commands:reference:ictu|Ictu()]] — Counts input rising edges and returns ''true'' when the preset value is reached. 
 +  * [[:en-us_commands:reference:ictd|Ictd()]] — Loads the preset value, then decrements the current value at each input rising edge. 
 +  * [[:en-us_commands:reference:ictud|Ictud()]] — Handles increment and decrement inputs in one counter. 
 +  * [[:en-us_commands:reference:igetcount|IgetCount()]] — Returns the current value of the specified counter. 
 +  * [[:en-us_commands:reference:isetcount|IsetCount()]] — Changes the current value of the specified counter. 
 +  * [[:en-us_commands:reference:ictuddownstate|IctudDownState()]] — Returns the lower-limit completion state of the Up/Down counter.
  
-^ Return Type ^ Command Prototype ^ +===== Data Buffers =====
-| ''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 edgesUse a unique ''id'' for each counter or buffer, and keep ''size'' to the required minimum.+  * [[:en-us_commands:reference:fifo|FIFO()]] — Outputs the first stored 16-bit data first. 
 +  * [[:en-us_commands:reference:filo|FILO()]] — Outputs the last stored 16-bit data first.
  
-[[:en-us_commands:builtin|← Built-in Command List]]+[[:en-us_commands:builtin|← Built-in function 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