Maker Pro
Maker Pro

spi unit in an Atmega48

H

Hul Tytus

Jan 1, 1970
0
sci.electronics.design
spi unit in an Atmega48

Does anyone here have some assembley code that works with Atmel's
Atmega48 spi unit?
The assembley code shown in their datasheet (which required some
repair) didn't work. This was done using the register definitions shown in
the register listing. To double check that listing a "part specific header
file" for the atmega48 would be handy. Anyone know of such a file for either
a c compiler or an assembler, preferably in ascii format?
Also the latest code attempted is shown below. If anyone see's an
error, please mention it.

Hul


testing: ; spi output
ldi areg, 0x2c ; areg is r16
out SPIDIR, areg ; spidir is 4
ldi areg, 4
out SPIOUT, areg ; spiout is 5

ldi areg, 0x70
sts SPCR, areg ; spcr is 0x2c

ldi bbreg, 0x55 ; bbreg is r17
send:
out SPDR, bbreg ; spdr is 0x2e
check:
in areg, SPSR ; spsr is 0x2d
andi areg, 0x80
brne check
rjmp send
 
Top