1.
Detecting a Positive Edge By Polling ACO
This part of the code shows the trivial way of detecting a positive edge on the comparator output. Even
though it uses only four words of code and no initial setup, this approach to the task might cause
problems. If a short pulse on the output occurs while the program is administrating the wait loop, the
pulse could be missed as ACO is directly connected to the comparator output. If the user wants to insert
code within the wait loop, the probability of detecting a short pulse will increase. Such code might be time-
out if no edge occurs within a specific period. The procedure for detection is as follows:
1.
If output is high, wait for output to go low.
2.
Wait until output goes high.
Figure 1-1. ACO Polling Flow Chart
S TART
N
Y
DONE
ACO = 0?
N
Y
ACO = 1?
Table 1-1. ACO Polling Performance Figures
Parameter
Value
Code Size (Words)
4
Response Time (Cycles)
3 - 5
Initialization Time (Cycles)
0
Register Usage
Low Registers: None
High Registers: None
Pointers: None
Interrupts Usage
None
Peripherals Usage
Analog Comparator
Atmel AVR128: Setup and Use of the AVR Analog Comparator [APPLICATION NOTE]
Atmel-0934C-Setup-and-Use-of-the-AVR-Analog-Comparator_AVR128_Application Note-07/2016
3