> Hello,
>
> the usual way of having a sendSPI() function is something like:
>
> #asm
> MOVF SSPBUF,W // Discard received data in buffer and
> // clear SSPSTAT_BF
> MOVFF spiData,SSPBUF // Put data to send on buffer
> // and start sending
> loopssp:
> BTFSS SSPSTAT_BF // If there's not received byte
> // in buffer (transmit completed)
> BRA loopssp // loop
> #endasm
>
> This is working perfectly as it should, but my data sending routine
> does this:
>
> calculateByteToSend()
> sendSPI()
> calculateByteToSend()
> sendSPI()
> calculateByteToSend()
> sendSPI()
> calculateByteToSend()
> sendSPI()
> etc...
>
> Of course, this isn't very efficient because the PIC waits to send
> the data when it would be calculating the next byte, so I tried:
>
>
> #asm
> loopssp:
> BTFSS SSPSTAT_BF // If there's not received byte
> // in buffer (transmit completed)
> BRA loopssp // loop
>
> MOVF SSPBUF,W // Discard received data in buffer and
> // clear SSPSTAT_BF
>
> MOVFF spiData,SSPBUF // Put data to send on buffer
> // and start sending
> #endasm
>
> But, the PIC hands after some transmits. Can anyone tell me what
> I'm doing wrong?
>
> Best regards,
>
> Brusque
>
> --
> ---------------------------------------------------------------------
> Edson Brusque Stagetronics Eletro Eletrônicos Ltda
> Research and Development Blumenau - SC - Brazil
>
http://www.ryan.com.br/netiqueta.htm http://www.citronics.com.br
> ---------------------------------------------------------------------