您的位置 首页 电子

128*64液晶简略单片机代码

控制芯片是常用的HD61202列驱动,HD61203行驱动一个汉字由16*16个像素点构成。扫描顺序上下,然后到第2列再上下,一次类推。显示结果:参考

操控芯片是常用的HD61202列驱动,HD61203行驱动

一个汉字由16*16个像素点构成。

扫描次序上下,然后到第2列再上下,一次类推。

显现成果:

参考文献:<<手把手教你学单片机c程序设计>> 下载地址:http://www.51hei.com/bbs/dpj-22812-1.html

主函数代码:

#include

#define uchar unsigned char
#define uint unsigned int

#define dataport P0 //数据口
sbit CS1=P2^4; //左显引脚
sbit CS2=P2^3; //右显引脚
sbit RST=P2^2; //复位引脚
sbit rs=P2^7; //数据或指令寄存器引脚
sbit rw=P2^6; //读或写操作引脚
sbit en=P2^5; //读写时能引脚
void delay(unsigned long v); //延时
void wcode(uchar c,uchar csl,uchar csr); //写指令
void wdata(uchar c,uchar csl,uchar csr); //写数据
void set_startline(uchar i); //设置起始行
void set_xy(uchar x,uchar y); //设置X,Y方向
void dison_off(uchar k); //显现器开或关
void reset();//复位
void lcd_init(); //显现器初始化
void lw(uchar x,uchar y,uchar dd); //将数据写入左右半屏
void display_hz(uchar xx,uchar yy,uchar n,uchar fb); //显现汉字函数
uchar code hz[]; //汉字字摸
#include “12864hh.h” //调用文件(函数库)

void main(void)
{
lcd_init();
delay(1000);
while(1)
{

display_hz(2,0,0,0); //display_hz(显现列方位,显现页方位,显现第几个汉字,是否反显);
display_hz(4,0,1,0);
display_hz(6,0,2,0);
display_hz(8,0,3,0);
display_hz(10,0,4,0);
display_hz(2,4,5,0);
display_hz(4,4,6,0);
display_hz(6,4,7,0);
display_hz(8,4,8,0);
display_hz(10,4,9,0);

}
delay(60000);

}

//———————————————字形码——————————————————

uchar code hz[]={
0x20,0x04,0x20,0x04,0x22,0x42,0x22,0x82,0xFE,0x7F,0x21,0x01,0x21,0x01,0x20,0x10,
0x20,0x10,0xFF,0x08,0x20,0x07,0x22,0x1A,0xAC,0x21,0x20,0x40,0x20,0xF0,0x00,0x00,/*”我”,0*/

0x00,0x40,0x40,0x20,0xB2,0xA0,0x96,0x90,0x9A,0x4C,0x92,0x47,0xF6,0x2A,0x9A,0x2A,
0x93,0x12,0x91,0x1A,0x99,0x26,0x97,0x22,0x91,0x40,0x90,0xC0,0x30,0x40,0x00,0x00,/*”爱”,1*/

0x00,0x08,0x00,0x08,0xF8,0x0B,0x28,0x09,0x29,0x09,0x2E,0x09,0x2A,0x09,0xF8,0xFF,
0x28,0x09,0x2C,0x09,0x2B,0x09,0x2A,0x09,0xF8,0x0B,0x00,0x08,0x00,0x08,0x00,0x00,/*”单”,2*/

0x00,0x80,0x00,0x40,0x00,0x30,0xFE,0x0F,0x10,0x01,0x10,0x01,0x10,0x01,0x10,0x01,
0x10,0x01,0x1F,0x01,0x10,0x01,0x10,0xFF,0x10,0x00,0x18,0x00,0x10,0x00,0x00,0x00,/*”片”,3*/

0x08,0x04,0x08,0x03,0xC8,0x00,0xFF,0xFF,0x48,0x00,0x88,0x41,0x08,0x30,0x00,0x0C,
0xFE,0x03,0x02,0x00,0x02,0x00,0x02,0x00,0xFE,0x3F,0x00,0x40,0x00,0x78,0x00,0x00, /*机”,4*/

声明:本文内容来自网络转载或用户投稿,文章版权归原作者和原出处所有。文中观点,不代表本站立场。若有侵权请联系本站删除(kf@86ic.com)https://www.86ic.net/qiche/dianzi/318442.html

为您推荐

联系我们

联系我们

在线咨询: QQ交谈

邮箱: kf@86ic.com

关注微信
微信扫一扫关注我们

微信扫一扫关注我们

返回顶部