If i am only shifting out 8 bits to a '595 register which of these is fastest:
1)
call pinLow(SHIFT_LAT) ' CS low
call shiftOutEx(SHIFT_DOUT, SHIFT_CLK, 8, tmp, &h01)
' LSB first, Fast, No timer used
call pinHigh(SHIFT_LAT) ' CS high
2)
SPIcmd(1,1,tmp,0,0) 'Given the CS pin was in the
SPIopen statement.
Thanks
Richard
SPIcmd vs Shiftout
Re: SPIcmd vs Shiftout
I'm guessing that the ShiftOutEx() might be slightly faster.rich wrote:If i am only shifting out 8 bits to a '595 register which of these is fastest?
I would suggest setting up a test loop where you execute each sequence 100 or 1000 times and measuring the elapsed time. The elapsed time can be measured by zeroing Register.RTCStopWatch before the loop and then reading it after the loop.
- Don Kinzer
Do i did a loop test comparing SHiftOutEX with SPICmd.
The loop went 1000 times for each and used the RTCStopWatch to time the loops.
For 1 byte:
ShiftOutEx = 22
SPICmnd = 23
For 2 bytes:
ShiftOutEx = 52
SPICmd = 25
So if speed is important and you have more than one byte to transfer then SPI is the way to go.
Richard
The loop went 1000 times for each and used the RTCStopWatch to time the loops.
For 1 byte:
ShiftOutEx = 22
SPICmnd = 23
For 2 bytes:
ShiftOutEx = 52
SPICmd = 25
So if speed is important and you have more than one byte to transfer then SPI is the way to go.
Richard