[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [avr-gcc-list] SPI
From: |
Leonard Tsai |
Subject: |
RE: [avr-gcc-list] SPI |
Date: |
Mon, 15 Dec 2003 23:23:20 -0800 |
to setup the SPI:
DDR_SPI = (1<<DD_MOSI) | (1<<DD_SCK) | (1<<DDB3) | (1<<DDB4);
SPCR = (1<<CPOL) | (1<<SPE) | (1<<MSTR) | (0<<SPR0) | (0<<DORD);
SPSR = 0x01;
// Send 16 bits
Void send16(u16 data) {
int r;
SS_lo; // Slave Select
SPDR = (data>>8);
while (!(SPSR & (1<<SPIF)));
SPDR = (data&0xff);
while (!(SPSR & (1<<SPIF)));
SS_hi;
}
Here is the result from the code:
http://www.nanocluster.net/Leonard/album03/HTML/p120303.htm
Hope this help
-----Original Message-----
From: address@hidden [mailto:address@hidden On Behalf Of ???
Sent: Monday, December 15, 2003 10:30 PM
To: D I Freeman
Cc: address@hidden
Subject: 회신:[avr-gcc-list] SPI
Hi..
How about the datasheet of AVR? For example, the datasheet of ATmega128 has
some sample source code written in C and ASM.
Thanks...
address@hidden
----- Original Message -----
From: D I Freeman
To: address@hidden
Sent: 2003년 12월16일 11:25(화)
Subject: [avr-gcc-list] SPI
Hi,
Can someone point me towards the documentation on how to use the SPI port with
avr-gcc please? I am either blind or stupid as of yet I have ben unable to find
any info on it.
Thanks
D
_______________________________________________
avr-gcc-list mailing list
address@hidden
http://www.avr1.org/mailman/listinfo/avr-gcc-list