Specifications
Select the
command
register
Disable the
Atmel SPI
module
Write each bit
to the data
line and toggle
the clock
Enable the
Atmel SPI
module
Select the
data register
Figure 15 Writing data to the decoder command register
To write to the configuration register, the hardware SPI module of the Atmel
ATmega103 cannot be used because the configuration of the data is not a standard 8-bit
packet. The data consists of 4-bits for an op-code (used to tell the decoder if the user is
writing or reading data), 4-bits for the command register required (there is more than
one command register) and then 16-bits for the data. The sending of this packet is done
by masking out each bit and placing it on the data line (SI pin) of the decoder then
raising the clock for a few clock cycles and lowering it again. This process is repeated
for all the 24bits and then the SPI module is enabled again and the data register is
selected ready to receive data.
Lower the
byte sync line
Place data into
the SPI register
Wait 6 clock
cycles
Raise the byte
sync line
Wait for SPI
to finish
Figure 16 Writing data to the decoder data register
Figure 16 displays the operations required to send data to the decoder’s data register.
The data register is selected already selected so is not required; the write begins by
raising the byte sync line which is used to tell the decoder that data is being sent. The
data is then placed into the Atmel’s SPI shift register which handles the sending of the
data. After a few clock cycles the byte sync line is then lowered and the function waits
until the SPI transfer is finished and the exits.
33










