现在用F28027驱动12864,按照时序进行编程,实在找不到问题,但是就是不能显示,求大家帮帮忙看一下,谢谢了
#include<DSP28x_Project.h>
#define CS GpioDataRegs.GPADAT.bit.GPIO5
#define SID GpioDataRegs.GPADAT.bit.GPIO6
#define CLK GpioDataRegs.GPADAT.bit.GPIO7
void Gpio_Init(void)
{
EALLOW;
GpioCtrlRegs.GPAPUD.all=0xFF;
GpioCtrlRegs.GPAMUX1.all = 0x00000000; // All GPIO
GpioCtrlRegs.GPAMUX2.all = 0x00000000; // All GPIO
GpioCtrlRegs.GPBMUX1.all = 0x00000000; // All GPIO
GpioCtrlRegs.GPADIR.all = 0xFFFFFFFF; // All outputs
GpioCtrlRegs.GPBDIR.all = 0x0000000F; // All outputs
EDIS;
}
void delay(int n)
{
while(n--);
}
void Sendbyte(unsigned char bytes) //发送一个字节
{
unsigned char i;
for(i=0;i<8;i++)
{
CLK=1;
SID=bytes&0x80; //取出最高位
CLK=0;
bytes<<=1; //左移
}
}
void write_com(unsigned char com)
{
CS=1;
Sendbyte(0xf8);
Sendbyte(com&0xf0);
Sendbyte((com&0x0f)<<4);
CS=0;
delay(0xff);
}
void write_data(unsigned char dat)
{
CS=1;
Sendbyte(0xfa);
Sendbyte(dat&0xf0);
Sendbyte((dat&0x0f)<<4);
CS=0;
delay(0xff);
}
void LCD_Init(void)
{
write_com(0x01);
write_com(0x30);
write_com(0x0c);
write_com(0x06);
write_com(0x02);
}
void main(void)
{
InitSysCtrl(); // In this function watchdog is disabled
DINT; //Disable interrupts,this has been done in the "InitPieCtrl();"function
InitPieCtrl(); //Initial PIE,in this function,interrupts are disabled,Clear all PIEIER registers,Clear all PIEIFR registers
IER = 0x0000;
IFR = 0x0000;
InitPieVectTable(); //Initialize the PIEvectable,let the interrupts point to their own ISR
Gpio_Init(); //Gpio initial function
LCD_Init();
write_com(0x80);
write_data(0x02);
write_data(0x02);
write_data(0x02);
while(1);
}
|