Go Down

Topic: 9 bit SPI (Read 1 time) previous topic - next topic

jeffonfire

I have no experience with SPI and am trying to use it to connect to a LCD, how do you set up the sck pin to provide the desired clock speed. I want to run it at 6 MHz.

Also are there any SPI tutorials better than the digital pot and spi eeprom tuts?

dareheaven

wow some technical stuff, well to me it is
:S

Grumpy_Mike

Quote
I want to run it at 6 MHz.


Sorry you can't. If you look at the data sheet you will see that the clock frequency is derived from the crystal divided by either 2, 4, 8, 16, 32, 64, or 128.
As the arduino has a 16MHz clock you can't get 6MHz. Closest you could get is if you select a divider value of divide by 4, this will give you 4MHz.

This is controlled by the two least significant bits of the SPCR register and the least significant bit of the SPSR register. See the processor data sheet for more details.

Go Up