Thanks it works fine today. Finally I don't use interrupt for the spi
controller because I've got an external interrupt to start the read..
I use this code (I call read_ads1252() from the EINT2 interupt) :
uchar SPI_read()
{
S0SPDR = 0xFF;
while(!(S0SPSR & 0x80));
return(S0SPDR);
}
void read_ads1252()
{
mesure = (SPI_read() << 8); //bits 1 to 8
mesure += SPI_read(); //bits 9 to 16
SPI_read(); //read bits 17 to 24 not use
}
Sebastien
--- In lpc2000@yahoogroups.com, "Marko Pavlin (home)" <mp@...> wrote:
>
> There is no difference between read and write. Just make dummy
write if
> you want read. Look at ADC datasheet when it sends data back? Clock
is
> allways generated by master (LPC in your case). I am using simple
SPI
> transfer function:
>
> unsigned char spi0_transfer(unsigned long dat) {
> S0SPDR = dat; // send data
> while (!(S0SPSR & 0x80)) ; // wait for transfer completed
> return S0SPDR;
> }
>
> I am not using ISR for SPI. Can you send your ISR for SPI?
For the SPI isr I used the HITEX books SPI exemples.
>
> Marko
>
>
> sebfr74 wrote:
>
> > Hi,
> > I try to read a 24 bits A/D converter from burr brown (ADS1252)
with
> > SPI interface. The converter send value in continue. There is data
> > ready signal before the value on the data pin. I synchronize the
read
> > with an external interrupt (P0.15/EINT2 and MISO pin are connected
> > together). The external interrupt runs well. But i don't
understand
> > how the SPI controler work :
> > I initialize the controler, the VIC interrupt for the SPI0 (see
the
> > code below).
> > - My first problem is I don't find in the user manual what start
the
> > SPI clock for a read. In other controler (ATMEL 89C51 for
example, a
> > 0x00 write to the data register start the clock).
> > - The second one is I have 8 clock bit on the SCLK line just at
the
> > startup an d before my first external interrupt (the one noramlly
who
> > start the SPI read...). I don't understand why I have got these 8
> > clock bits ? After these clock the SPI seems to be blocked...
> >
> > Thanks for your help,
> > Sebastien
> >
> > //My initialisation code...
> > VICVectCntl0 = 0x0000002A;
> > VICVectAddr0 = (unsigned)SPI_ISR;
> > VICIntEnable = 0x00000400;
> >
> > PINSEL0 |= 0x00005500;
> > S0SPCCR = 20;
> > S0SPCR = 0x000000A0;
> >
> >
> >
> >
> >
> >
> > SPONSORED LINKS
> > Microcontrollers
> > <http://groups.yahoo.com/gads?
t=ms&k=Microcontrollers&w1=Microcontrollers&w2=Microprocessor&w3=Intel
+microprocessors&w4=Pic+microcontrollers&c=4&s=95&.sig=mfaAujKZXA2Z_vx
re9sGnQ>
> > Microprocessor
> > <http://groups.yahoo.com/gads?
t=ms&k=Microprocessor&w1=Microcontrollers&w2=Microprocessor&w3=Intel+m
icroprocessors&w4=Pic+microcontrollers&c=4&s=95&.sig=9jjd2D3GOLIESVQss
LmLsA>
> > Intel microprocessors
> > <http://groups.yahoo.com/gads?
t=ms&k=Intel+microprocessors&w1=Microcontrollers&w2=Microprocessor&w3=
Intel+microprocessors&w4=Pic+microcontrollers&c=4&s=95&.sig=OMnZuqMZX9
5mgutt4B-tDw>
> >
> > Pic microcontrollers
> > <http://groups.yahoo.com/gads?
t=ms&k=Pic+microcontrollers&w1=Microcontrollers&w2=Microprocessor&w3=I
ntel+microprocessors&w4=Pic+microcontrollers&c=4&s=95&.sig=Malspbd0T4R
q3M4Q0nHrfw>
> >
> >
> >
> > YAHOO! GROUPS LINKS
> >
> > * Visit your group "lpc2000
> > <http://groups.yahoo.com/group/lpc2000>" on the web.
> >
> > * To unsubscribe from this group, send an email to:
> > lpc2000-unsubscribe@yahoogroups.com
> > <mailto:lpc2000-unsubscribe@yahoogroups.com?
subject=Unsubscribe>Show quoted textHide quoted text
> >
> > * Your use of Yahoo! Groups is subject to the Yahoo! Terms of
> > Service <http://docs.yahoo.com/info/terms/>.
> >
> >
> >
>