标题:
LCD12864液晶串行驱动显示
[打印本页]
作者:
3574
时间:
2018-12-26 20:52
标题:
LCD12864液晶串行驱动显示
12864液晶显示
#include "lcd12864.h"
#include "reg51.h"
void delay_ms(unsigned char nms)
{
unsigned int i, j;
for(i = nms; i > 0; i--)
for(j = 110; j > 0; j--);
}
void lcd_sendbyte(unsigned char byte)
{
unsigned char i;
for(i = 0; i < 8; i++)
{
SCLK = 0;
delay_ms(2);
SID = (bit)(byte&0x80);
SCLK = 1;
byte = byte << 1;
}
}
void write_cmd(unsigned char cmd)
{
CS = 1;
lcd_sendbyte(0xf8);
lcd_sendbyte(0xf0&cmd);
lcd_sendbyte(0xf0&(cmd << 4));
CS = 0;
delay_ms(10);
}
void write_dat(unsigned char dat)
{
CS = 1;
lcd_sendbyte(0xfa);
lcd_sendbyte(0xf0&dat);
lcd_sendbyte(0xf0&(dat << 4));
CS = 0;
delay_ms(10);
}
void lcd_pos(unsigned char x, unsigned char y)
{
unsigned char pos;
switch(x)
{
case 0: x = 0x80; break;
case 1: x = 0x90; break;
case 2: x = 0x88; break;
case 3: x = 0x98; break;
}
pos = x + y;
write_cmd(pos);
}
void lcd12864_init()
{
PSB = 0;
write_cmd(0x30);
delay_ms(5);
write_cmd(0x0c);
delay_ms(5);
write_cmd(0x01);
delay_ms(5);
}
void lcd_display(unsigned char line, unsigned char column, char *str)
{
lcd_pos(line, column);
while(*str)
{
write_dat(*str++);
}
}
1.串行驱动显示.rar
2018-12-26 20:49 上传
点击文件名下载附件
下载积分: 黑币 -5
39.63 KB, 下载次数: 12, 下载积分: 黑币 -5
12864显示
作者:
yangguo48
时间:
2019-2-12 18:35
垃圾,别下载
欢迎光临 (http://www.51hei.com/bbs/)
Powered by Discuz! X3.1