在线时间199 小时
UID2090042
注册时间2015-1-3
NXP金币115
该用户从未签到
金牌会员
 
- 积分
- 1532
- 最后登录
- 2021-7-20
|

楼主 |
发表于 2015-5-28 12:31:54
|
显示全部楼层
void LCDShiftWrite(unsigned char dat)
{
unsigned char i;
unsigned char Series,Temp;
SCL_L;
Series = dat;
for(i=0; i<8; i++)
{
SCL_L;
Temp=Series & 0x80;
if(Temp)
{
SDA_H;
}
else
{
SDA_L;
}
SCL_H;
Series = Series << 1;
}
}
void send_cmd(unsigned char cmd, unsigned char dat)
{
A0_L;
CS_L;
LCDShiftWrite(cmd|dat);
CS_H;
A0_H;
}
void send_dat(unsigned char dat)
{
CS_L;
LCDShiftWrite(dat);
CS_H;
}
void LCDInit(void)
{
LCD_GPIO_INIT();
RES_L;
delay(100);
RES_H;
delay(100);
send_cmd(Function_Set,0x01);
send_cmd(Set_V0,0x30);
send_cmd(Set_Test_Mode,0x02);
send_cmd(Function_Set,0x00);
send_cmd(Display_Control,0x04);
}
void LCD_set_XY(unsigned char x,unsigned char y)
{
send_cmd(Set_X_Address,x);
send_cmd(Set_Y_Address,y);
}
void cls(void)
{
int i;
send_cmd(Set_X_Address, 0);
send_cmd(Set_Y_Address, 0);
for(i=0;i<960;i++)
send_dat(0x00);
send_cmd(Set_X_Address, 0);
send_cmd(Set_Y_Address, 0);
}
void putch(unsigned char x, unsigned char y, unsigned int ch)
{
unsigned char i;
send_cmd(Set_X_Address,x);
send_cmd(Set_Y_Address,y);
for(i=0;i<5;i++)
send_dat(FONT[(ch-0x20)*5+i]);
}
void putstr(unsigned char x, unsigned char y, char *str)
{
while(*str!=0)
{
putch(x,y,*str++);
x=x+6;
}
} |
|