User Tools

Site Tools


en-us_commands:reference:tcntsetup

Differences

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

Link to this comparison view

Next revision
Previous revision
en-us_commands:reference:tcntsetup [2026/09/07 21:52] – 만듦 - 바깥 편집 127.0.0.1en-us_commands:reference:tcntsetup [2026/09/08 00:53] (current) – 바깥 편집 127.0.0.1
Line 16: Line 16:
  
 <code cpp> <code cpp>
-TCNTSETUP(1, true);+const uint8_t COUNTER_TIMER = 1; 
 + 
 +void setup() { 
 +  Serial.begin(115200); 
 +  TCNTSETUP(COUNTER_TIMER, true);  // Configure the timer's external clock input and 32-bit extension mode. 
 +
 + 
 +void loop() { 
 +  static uint16_t previousOverflow = 0; 
 +  const uint16_t overflowCount = TCNTOUT(COUNTER_TIMER);  // Return the accumulated upper overflow value in 32-bit extension mode. 
 +  if (overflowCount != previousOverflow) { 
 +    previousOverflow = overflowCount; 
 +    Serial.println(overflowCount); 
 +  } 
 +}
 </code> </code>
  
Line 25: Line 39:
   * Do not interpret ''TCNTOUT()'' as a simple function for reading the current 16-bit counter.   * Do not interpret ''TCNTOUT()'' as a simple function for reading the current 16-bit counter.
   * In interrupt ISRs on other products, perform no work other than incrementing the count.   * In interrupt ISRs on other products, perform no work other than incrementing the count.
 +
 +===== Built-in Commands in the Same Category =====
 +
 +  * [[:en-us_commands:reference:tcntout|TCNTOUT() View detailed description]]
  
 [[:en-us_commands:builtin|← Built-in Command List]] [[:en-us_commands:builtin|← Built-in Command List]]
  
en-us_commands/reference/tcntsetup.1788785569.txt.gz · Last modified: by 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki