---------- > From: Smith, Patrick > To: PICLIST@MITVMA.MIT.EDU > Subject: FW: SPI w/73A > Date: Wednesday, March 26, 1997 2:10 PM > > Hello, > I am currently using a 73A in a project and need to have more than 8 -bit > A/D for one input line. > I have been looking at an A/D that is made to interface to the SSP module > in the SPI mode, the problem is > I dont understand how to simultaneously send and receive data. Can > anyone give a hint? > > Thanks > > Pat ***SPI*** Actually it is very simple. I have used the SPI on the Motorola 68HC11, PIC and others...so forget the data books for a moment. In plain (brief) English the SPI works like this: One device is configured as the Master. This device initiates and provides the clocking for data transfers. Other devices act as slaves. Slave devices wait for data to be clocked to them. For simplicity lets consider a single Slave connected to the Master. Slave - configure SPI port for clock phase, mode and clock rate. Load SPI data register with data to send to Master. Either poll or set interrupt for SPIF (SPI transfer complete). Data received from the Master will reside in the same data register. Just read it. Master - configure SPI port with SAME clock phase, mode and clock rate as the Slave device. Load data register with byte to send to Slave on SPI bus. ***This initiates the transfer. *** Wiring is as follows: Master Slave DO ---------------DI DI ----------------DO CLK--------------CLK DO = data out DI = data in CLK =clock Note how DO and DI are cross-wired for Master and Slave. Data is exchanged simultaneously, bit for bit. Hope this brief overview helps. Once you become acclimated with the use of the SPI it can provided many uses in future projects. Steve Somlyody "Imagination is more important than knowledge" A.E.