联系QQ1033972671
我使终读不对,搞了好多天了。资料都看了好多次了。
unsigned char LCD_ReadData() //LCDVF0=CS; LCDVF1=SDI; LCDVF2=SCK
{
#if 1 //16-bit Serial Interface SCL????????·???????
unsigned short i,MB=0X40;
unsigned char data =0;
SPI_Start();
i = data;
MB=0Xc0;
for(i=0;i<8;i++)
{
SCLK(0);
Delayus(100);
if(MB&0x80)
SDI(1);
else
SDI(0);
Delayus(100);
SCLK(1);
Delayus(100);
MB<<=1;
}
Delayus(100);
SetSDItoIN();
Delayus(100);
for(i=0;i<8;i++)
{
SCLK(0);
Delayus(100);
Delayus(100);
SCLK(1);
Delayus(100);
data <<=1;
if(CheckSDI()){
data++;
}
Delayus(100);
}
Delayus(100);
SPI_Stop();
return data;
#endif
}
unsigned short ID[3];
void NT35512_Read_ID(void)
{
LCD_REG(0XDA00);
ID[0] = LCD_ReadData();
LCD_REG(0XDB00);
ID[1] = LCD_ReadData();
LCD_REG(0XDC00);
ID[2] = LCD_ReadData();
}
上升沿发送数据。以上为我的读程序,我的写程序对屏初始化都正常,请问读程序哪里有问题?
void SPI_Start(void)
{
SetSDItoOUT();
SCLK(1);
Delayus(100);
CS(1);
Delayus(100);
CS(0);
Delayus(50);
SCLK(0);
}
void SPI_Stop(void)
{
SCLK(1);
Delayus(50);
CS(1);
Delayus(100);
}
谢谢你的PDF
一周热门 更多>