I am trying to communicate with a Nokia 1202 LCD with my Arduino using SPI.
The LCD using the STE2007 Controller. As per the datasheet here @ page 12, you find that the min time for SCLK is 250ns => 4MHz and no maximum value listed. So what i understand is that this driver can communicate using SPI with SCLK being max. of 4MHz.
Since my arduino board is running at 16MHz, and I will be using the 'spi' library this is what I think i should do:
- set bits SPR0 and SPR1 in the SPCR register to set the spi clock speed @ 4MHz
- do spi.begin()
- execute spi commands as normal
Is this correct ?
Something like ...
void setup()
{
pinMode(SPI_SS, OUTPUT);
pinMode(SPI_DC_SEL, OUTPUT);
SPI.begin();
SPI.setBitOrder(MSBFIRST);
//set spi register to set SCLK @ 4Mhz
//SPI2X = SPR1 = SPR0 = 0
SPCR &= ~(1<<SPR1);
SPCR &= ~(1<<SPR0);
SPSR &= ~(1<<SPIX2);
}