Attiny28l/v – Rainbow Electronics ATtiny28L User Manual

Page 30

Advertising
background image

30

ATtiny28L/V

1062E–10/01

PA2 is the built-in, high-current LED driver and it is always an output pin. The output
buffer can sink 25 mA at V

CC

= 2.0V. When MCONF is zero, modulation is switched off

and the pin acts as a normal high-current output pin. The following truth table shows the
effect of various PORTA2 and MCONF settings.

The modulation period is available as a prescale to Timer/Counter0 and thus, this timer
should be used to time the length of each burst. If the number of pulses to be sent is N,
the number 255 - N should be loaded to the timer. When an overflow occurs, the trans-
mission is complete.The OOM01 and OOM00 bits in TCCR0 can be configured to
automatically change the value on PA2 when a Timer/Counter0 overflow occurs. See
“Timer/Counter0” on page 23 for details on how to configure the OOM01 and OOM00
bits.

The modulation period is available as a prescale even when PORTA2 is high and mod-
ulation is stopped. Thus, this prescale can also be used to time the intervals between
bursts.

To get a glitch-free output, the user should first configure the MODCR register to enable
modulation. There are two ways to start the modulation:

1.

Clear the PORTA2 bit in Port A Data Register (PORTA).

2.

Configure OOM00 and OOM01 bits in the Timer/Counter0 Control Register
(TCCR0) to clear PA2 on the next overflow. Either an overflow or a forced over-
flow can then be used to start modulation.

The PA2 output will then be set low at the start of the next cycle. To stop the modulated
output, the user should set the PORTA2 bit or configure OOM00 and OOM01 to set PA2
on the next overflow. If the MODCR register is changed during modulation, the changed
value will take effect at the start of the next cycle, producing a glitch-free output. See
Figure 23 below and Figure 30 on page 38.

Table 14. PA2 Output

PORTA2

MCONF

PA2 Output

0

0

0

0

1 - 7

Modulated

1

X

1

Advertising