A class _ica
object is a 16-bit capture unit. It has the following relative objects:
- one counter, whose name is given by
( capture0, counter )
- one input pin, whose name is given by
( capture0, pin )
It is used in:
- Instructions that do not produce C code
The HW_BITS()
instruction returns the number of bits of the capture register:
#if HW_BITS( capture0 ) != 16
# error A 16-bit capture unit is required!
#endif
- Interrupts
The capture unit can trigger an anonymous IRQ when a capture event occurs.
Actions
configure
:
hw( configure, (counter0,capture0),
[ input, pin_icp
| acmp0, ]
[ edge, falling
| rising, ]
[ filter, on
| off ] );
hwa( configure, counter0capture0,
[ input, pin_icp
| acmp0, ]
[ edge, falling
| rising, ]
[ filter, on
| off ] );
read
:
uint16_t capture =
hw( read, capture0 );
write
:
hw( write, capture0, value );
hwa( write, capture0, value );
Status
The capture event flag can be accessed through interrupt-related instructions:
if (
hw( read, (counter0,irq,capture0) ) ) {
hw( clear, (counter0,irq,capture0) );
hw( disable, (counter0,irq,capture0) );
}