beautypg.com

Bit timer, Transmit mode bit coding and timing, Interrupts – Rainbow Electronics AT86RF401 User Manual

Page 11: Bit timer in receive mode, Bit timer operation as a generic timer/counter

background image

11

AT86RF401

1424D–RKE–09/02

Bit Timer

A hardware assist has been included in the

AT86RF401

to make transmission of data

easier. Keying of the transmitter is timed by this logic, and interrupts are generated
when data is needed by the timer or when transmission is complete. The timer also sup-
ports code that uses polling instead of interrupts. Using polling instead of interrupts may
facilitate higher bit rates. Additionally, this timer may be used to time pulses arriving at
the I/O3 pin. This enables the AT86RF401 to be used to decode the signal detected by
an external receiver chip.

Transmit Mode Bit Coding and
Timing

Bit coding is done by the AVR before data is sent to the bit timer. Bit timing is controlled
by the count value in the Bit Timer Count (BTCNT) register and the two most significant
bits in the Bit Timer Control Register (BTCR). Generally the time of each bit is:

where

P

xx

is the period of each time slot and

countval is the counter value in the BTCNT

and BTCR registers.

P is the AVR clock period that is set in the PWR_CTL register.

countval = {BTCR[7:6], BTCNT[7:0]}.

Interrupts

There are two interrupts associated with transmit mode:

1.

Transmit Buffer Empty Interrupt: This vectors to address 0x04. Flag 0 is set, and,
if enabled, this interrupt is generated when the timer removes the value from the
DATA bit in the BTCR. This interrupt service routine should load the next bit into
the DATA bit in the BTCR.

2.

TXDONE Interrupt: This vectors to address 0x02. Flag 2 is set, and, if enabled,
an interrupt is generated when the counter has counted down to zero and the
buffer is empty. This indicates that the transmission is complete. This interrupt
service routine should turn off the transmitter and turn off the bit timer using the
mode bits.

Bit Timer in Receive Mode

When put into receive mode, the bit timer times pulses arriving at the I/O3 pin. When
enabled, the counter counts up from zero and places that value in the BTCNT register
when an edge occurs. If the edge is rising, the DATA bit in the BTCR is set. If the edge
is falling, the DATA bit in the BTCR is reset. This mode may be used to decode signals
from a receiver chip easily.

Bit Timer Operation as a
Generic Timer/Counter

The Bit Timer may be used as a generic timer by not allowing it to key off the transmitter.
An interrupt is generated after the amount of time dictated by the count value.

P

x x

P

countval

1

+

(

)

Ч

=