即上一章GPIO问题解决之后一个小时,LCD12864的驱动也已经搞定了,用的DSP的内部SPI接口。上图:
部分源代码:(完全的见附件)
void lcd_init(void)
{
Uint16 i,m;
LCD_CS =0;
NOP;
NOP;
NOP;
NOP;
NOP;
LCD_A0 = 0;
NOP;
NOP;
NOP;
NOP;
NOP;
spi_xmit(0xAF40);
spi_xmit(0xA6A0);
spi_xmit(0xC8A4);
spi_xmit(0xA22F);
spi_xmit(0x2F00);
spi_xmit(0x2481);
for(i=0;i<8;i++)
{
LCD_A0 = 0;
NOP;
NOP;
NOP;
NOP;
NOP;
spi_xmit(i|0x24B0);
spi_xmit(0x1000);
LCD_A0 = 1;
NOP;
NOP;
NOP;
NOP;
NOP;
for(m=0;m<64;m++)
spi_xmit(0xAAAA);
}
}
如上,IO位赋值的时候加了五个指令周期的延时。详细分析见本帖系列上一章
本文含有来自论坛的附件或图片点击查看原帖附件。