A digitalWrite() call takes about 15us to execute. There are two pins that need to be controlled meaning that the absolute max speed you can achieve using the wiring library is 2*15us = 30us per clock cycle, or 33kHz.The Hardware SPI can run at a maximum of half FCPU. For an Arduino, that is 8MHz.Based on that, using the SPI library should be around 240 times faster.
A digitalWrite() call takes about 15us to execute.
SPDR = byteToSend;while(!(SPSR & (1<<SPIF)));
A blocking example:
while(!(SPSR & (1<<SPIF))) continue; //wait if the prior transmission hasn't endedSPDR = byteToSend;
byteRecieved = SPDR;
Please enter a valid email to subscribe
We need to confirm your email address.
To complete the subscription, please click the link in the
email we just sent you.
Thank you for subscribing!
via Egeo 16