if your data is shifted by one bit that means you have the clock
setup wrong. The easiest way is to scope CLK and SDO while you are
sending 0x55 and then compare what you see to how the bus should be
for ADS7807.
>How does the SCK work?
Acoording to how you setup the SCK (in LPCxxx registers) data will
be shifted in/out on rising/falling edge on the SCK and you can
setup SCK to be idle low or high.
Gus
--- In lpc2000@yahoogroups.com, dasbento@a... wrote:
>
> Hello,
>
> I'm using SPI to read data of ADS7807U. My problem is not get to
read
> the last bit, i.e, bit0. How does the SCK work?
>
> Anybody already work with this and can I help me???
>
> Thanks
> Domingos
>
>
> IOCLR0 |= SSEL0; //select AD
> IOCLR0 |= AD_RC; //(R/C = 0)
>
> delay(2); //wait 50ns
>
> IOSET0 |= SSEL0;
> IOSET0 |= AD_RC;
>
> while(!(IOPIN1 & busy_x)){} //wait for busy is 1
>
> IOCLR0 |= SSEL0; //select AD
>
>
> for(i=0;i<2;i++){
> SPI0_SPDR = 0x10;
>
> while(!(SPI0_SPSR & SPIF)){} //wait that transmit
>
> if(i==0){
> gyro_x = SPI0_SPDR; //save the 8 most significant bits
>
> gyro_x = (gyro_x << 8);
> }else{
> gyro_x += SPI0_SPDR;
> }
> }
>
> IOSET0 |= SSEL0; //deselect AD
> _________________________________________________________
> CEAC Cursos de formação profissional - peça informações aqui.:
> http://ceac.online.pt/Message
Re: read with SPI
2004-11-26 by Gus
Attachments
- No local attachments were found for this message.