在日常的学习中我学习了16*2的黑白屏LCD1602,如今在完成MP3的制作时,黑白屏已经不能满足需求,所以要使用彩屏。彩屏我选择使用LCD12864。
1.LCD12864的样式
LCD12864是由于此屏由128*64格得名,
2.LCD12864的接法
LCD12864一共有20个管脚,在德飞莱开发板上是这样接的。
彩屏占用了P0口和P2口,所以在使用彩屏时,应尽量减少在P2口和P0的布线,除非是短暂性的操作,例如按键之类的操作。
3.LCD12864的程序
鉴于LCD12864的数据手册,可以写出以下程序:
void initial_lcd() reentrant
{
lcd_reset=0;
delay(100);
lcd_reset=1;
delay(100);
transfer_command_lcd(0xe2);
delay(5);
transfer_command_lcd(0x2c);
delay(50);
transfer_command_lcd(0x2e);
delay(50);
transfer_command_lcd(0x2f);
delay(5);
transfer_command_lcd(0x23);
transfer_command_lcd(0x81);
transfer_command_lcd(0x28);
transfer_command_lcd(0xa2);
transfer_command_lcd(0xc8);
transfer_command_lcd(0xa0);
transfer_command_lcd(0x40);
transfer_command_lcd(0xaf);
}
void lcd_address(uint page,uint column)
{
column=column-0x01;
transfer_command_lcd(0xb0+page-1);
transfer_command_lcd(0x10+(column>>4&0x0f));
transfer_command_lcd(column&0x0f);
}
void clear_screen() reentrant
{
unsigned char i,j;
for(i=0;i<9;i++)
{
transfer_command_lcd(0xb0+i);
transfer_command_lcd(0x10);
transfer_command_lcd(0x00);
for(j=0;j<132;j++)
{
transfer_data_lcd(0x00);
}
}
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)