On Jun 7, 2004, at 5:57 AM, Rodrigo wrote: > I’m trying to communicate with a AD converter through a SPI interface. > In the AD datasheet, it’s said that I need to have DIN line (from AD) > in low level when it’s transmitting. This means that I have to write > 0x00 on MOSI line while i’m receiving the data. The problem is, > there’s just one data register, can I do that? If I can’t, can I > change just the MOSI pin to GPIO mode and put on low level while I’m > receiving data? With SPI the transmit and receive register are the same - bits are shifted out on transmit as they are shifted in on receive. So, to keep MOSI low while receiving (and to generate the clock needed to drive the whole process), simply write a 0 to the SPDR register. Wait for the transfer to complete (checking the SPSR register) and then read SPDR to get the received byte. Shannon
Message
Re: [lpc2000] SPI
2004-06-07 by Shannon Holland
Attachments
- No local attachments were found for this message.