我们公司有一块DSP5509开发板。因为5509通用IO口少,所以用CPLD扩展IO口,扩展后
接了个12864.可是编程与单片机不同。我看不懂,贴出部分代码
。。。。。。。。。。。。。
#define CESECT1 0x200000
#define CESECT2 0x400000
#define CESECT3 0x600000
。。。。。。。。。。。。。。。。。
addr = (int *)CESECT2;
LCDCOM = (int *)CESECT3;
LCDOUT = (int *)CESECT3;
LCDIN = (int *)CESECT2;
。。。。。。。。。。。。。。。。。。。。。
/*----------------LCD忙检测----------------*/
void chk_busy()
{
unsigned int temp;
*addr = 0x00ef;
*LCDCOM = 0x0005; //RS=0(comm), RW=1(read), RST=1
temp = 0x0080;
while((temp&0x0080)!=0)
{
*LCDCOM = 0x000d; //EN=1
*addr = 0x00f7;
delay(10);
temp = *LCDIN;
*addr = 0x00ef;
*LCDCOM = 0x0005; //EN=0
}
*addr = 0x00ff;
//while((LCD_DAT&0x80)!=0);
}
/*------------------写LCD------------------*/
void wr_lcd(unsigned char dat_comm, unsigned int content)
{
chk_busy();
if(dat_comm)
{
*addr = 0x00ef;
*LCDCOM = 0x0003; //RS=1(data), RW=0(write), RST=1
*addr = 0x00d7;
*LCDOUT = content;
*addr = 0x00cf;
*LCDCOM = 0x000b; //EN=1
delay(30);
*LCDCOM = 0x0003; //EN=0
*addr = 0x00ff;
}
else
{
*addr = 0x00ef;
*LCDCOM = 0x0001; //RS=0(data), RW=0(write), RST=1
*addr = 0x00d7;
*LCDOUT = content;
*addr = 0x00cf;
*LCDCOM = 0x0009; //EN=1
delay(30);
*LCDCOM = 0x0001; //EN=0
*addr = 0x00ff;
}
}
/*----------------清DDRAM------------------*/
void clrram (void)
{
wr_lcd (comm,0x30);
wr_lcd (comm,0x01);
}
/*------------------初始化-----------------*/
void lcd_init(void)
{
*addr = 0x00ef;
delay(10);
*LCDCOM = 0x0000; //RESET
delay(1000);
*LCDCOM = 1;
wr_lcd (comm,0x30); /*30---基本指令动作*/
wr_lcd (comm,0x01); /*清屏,地址指针指向00H*/
wr_lcd (comm,0x06); /*光标的移动方向*/
wr_lcd (comm,0x0c); /*开显示,关游标*/
}
这里的addr,LCDCOM,LCDOUT,LCDIN都是什么意思啊?谢谢!
|