51单片机-240128液晶程序与调试
可能是习惯了12864这样的液晶,结果在硬件连接上就出来了一个重大错误,结果弄了好久也只显示条形点阵,而且对比度很差。这个错误就是240128液晶的对比度调节电位器,两端一端接地,另一端接VOUT(22脚)!而我习惯性的接到了5V!在曹老师的提醒下才发现了这个问题,在手册的角落里发现了硬件连接图:
调试效果图:
最后附上调试好的程序:
//=============================================
//控制器:51单片机
//液晶: OCMJ8X15D-2(240128)带字库
//模式: 默认8080系列接口
//时间: 2013.2.26
//=============================================
#include
sbit lcd_rs =P2^0;
sbit lcd_wr =P2^1;
sbit lcd_rd =P2^2;
sbit lcd_cs1 =P2^3;
sbit lcd_cs2 =P2^4;
sbit lcd_busy =P2^5;
sbit lcd_int =P2^6;
sbit lcd_rst =P2^7;
#define lcd_regname P1
#define lcd_regdata P1
#define lcd_regnada P1
#define lcd_data P1
#define lcd_control P2
#define uchar unsigned char
#define uint unsigned int
//=============================================
void lcd_regwr(uchar regnada) small;
void delay(int k);
void gotoxy(uchar x,uchar y) small;
//=============================================
uchar code tab1[]={
" 华 中 科 技 大 学 "
" 光 电 国 家 实 验 室 "
"湖北省武汉市洪山区珞瑜路1037号"
" 黄鹤楼-崔颢 "
"昔人已乘黄鹤去,此地空余黄鹤楼"
"黄鹤一去不复返,白云千载空悠悠"
"晴川历历汉阳树,芳草萋萋鹦鹉洲"
"日暮乡关何处是,烟波江上使人愁"};
uchar code tab2[]={
" "
" "
" 欢迎访问我的网易博客 "
"http://suneleo.blog.163.com "
" 欢迎给我留言或者发邮件交流 "
" mail:suneleo@163.com "
" "
" "};
uchar code tab3[]={
/*-- 调入了一幅图像:C:\Users\Administrator\Desktop\240128 tuzki.bmp --*/
/*-- 宽度x高度=240x128 --*/
0x00,0x38,0x00,0x00,0xFB,0xFC,0x00,0x70,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38,
0x00,0x01,0xFF,0xFE,0x00,0x70,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x2E,0x00,0x01,
0x3F,0xFF,0x60,0x1A,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0xFF,
0xA0,0x06,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x07,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0x8F,0xC0,0x07,
0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x1F,0xF0,0x00,0x00,0x00,0x01,0x10,0x00,0x00,0x0F,0xB3,0xE8,0x07,0xE0,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,
0xF0,0x04,0x00,0x00,0x1F,0x3C,0x00,0x00,0x0F,0x03,0xEC,0x00,0x78,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0E,0xFF,0xF8,0x0F,
0x08,0x00,0x08,0x06,0x00,0x00,0x0F,0x01,0xF4,0x00,0x78,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x00,0x1D,0xFF,0xF8,0x07,0x03,0xFF,
0x17,0xF8,0x00,0x00,0x0F,0x80,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0xC1,0x00,0x00,0x00,0x00,0x03,0xFC,0xF8,0x00,0x1F,0xFF,0x0F,0xFF,
0x40,0x00,0x0F,0xB0,0xF8,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x28,
0x1E,0x7E,0xE2,0x00,0x00,0x00,0x0F,0xFA,0xFA,0x05,0x3F,0xFF,0x0F,0xFF,0xDC,0x00,
0x0F,0xB0,0xF8,0x1D,0xC1,0x90,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0xFF,0xFF,
0x60,0x00,0x00,0x00,0x1F,0xF6,0xFA,0x07,0xFF,0xFF,0x1F,0xFF,0xFC,0x00,0x07,0xD0,
0x7C,0x0F,0xFF,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0
51单片机240128液 相关文章:
- Windows CE 进程、线程和内存管理(11-09)
- RedHatLinux新手入门教程(5)(11-12)
- uClinux介绍(11-09)
- openwebmailV1.60安装教学(11-12)
- Linux嵌入式系统开发平台选型探讨(11-09)
- Windows CE 进程、线程和内存管理(二)(11-09)