12864(带字库)并行方式显示汉字和图形-CVAVR程序

发布者:shtlsw最新更新时间:2016-10-30 来源: eefocus关键字:带字库  并行方式显示  AVR程序 手机看文章 扫描二维码
随时随地手机看文章
// HS12864-15B  - 并行方式  

// 带字库
// 芯片 ATMEGA16L 
// 时钟 4MHz 内部
// 采用系统自带延时程序   
// 功能1:汉字及字母的显示,汉字不能错位
// 功能2:图形显示,显示横线、竖线、边框、128*64图像、64*64图像    
// 注意:采用了文本区和图形区清零函数,汉字和图形显示切换时要注意,基本指令集和扩充指令集的转换  
// 保存图像的数组最后不能有逗号    

#include  
#include

#define  LCD_Bus   PORTC    // 数据总线
#define  rs        PORTD.2  // 数据&指令选择,H:写数据,L:写指令    
#define  rw        PORTD.3  // 读&写选择,H:read,L:write
#define  e         PORTD.4  // 读写使能
#define  psb       PORTD.5  // psb=H,并口模式, psb=L,串口模式
#define  rst       PORTD.6  // LCD复位,低有效
#define  bf        7        // 忙闲状态标志位,PORTC.7,H:内部正执行操作,L:空闲      
#define  run       PORTB.7  // 运行标志

void init_lcd(void);                       // 初始化
void chk_busy(void);                       // 检测忙闲
void wr_data(unsigned char dat);           // 写数据到LCD
void wr_comm(unsigned char comm);          // 写命令到LCD
void wr_str(unsigned char flash *s);       // 向LCD写字符串,长度64字符之内(32个汉字),指针要指向ROM  
void hz_disp(void);                        // 写汉字或字母  
void img_disp (unsigned char flash *img);  // 显示图片128*64
void img_disp2(unsigned char flash *img);  // 显示图片64*64  左半屏
void img_disp3(unsigned char flash *img);  // 显示图片64*64  右半屏
void LcdClearTXT(void);                    // 文本区RAM清零
void LcdClearBMP(void);                    // 图形区RAM清零
void lcdfill(unsigned char disdata);       // 整屏全亮或显示竖条
void Disp_H_Line(void);                    // 显示横条
void frame(void);                          // 显示边框

flash unsigned char ex1[] = {"泰  山  电 子"};  //字符串以\0结束
flash unsigned char ex2[] = {"  欢  迎  您  "};
flash unsigned char ex3[] = {"Tai Shan Dian Zi"};  
flash unsigned char ex4[] = {"Wellcome to you!"};   
flash unsigned char ex5[] = {"黄河远上白云间"}; 
flash unsigned char ex6[] = {"一片孤城万仞山"};
flash unsigned char ex7[] = {"羌笛何须怨杨柳"};  
flash unsigned char ex8[] = {"春风不度玉门关"};   
flash unsigned char ex9[] = {"TAI SHAN DIAN ZI"}; 
flash unsigned char ex10[] = {"Designer:Charlie"};     

flash unsigned char tab[]={ 
/*--  调入了一幅图像:联通图标 4567.bmp  --*/
/*--  宽度x高度=128x64  --*/
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,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,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,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,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X07,0XFF,0X00,0X00,0X1F,0XFC,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X3F,0XFF,0XE0,0X00,0XFF,0XFF,0X80,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0XFF,0XFF,0XF8,0X03,0XFF,0XFF,0XE0,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X03,0XFF,0XFF,0XFE,0X0F,0XFF,0XFF,0XF8,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X07,0XFF,0XFF,0XFF,0XBF,0XFF,0XFF,0XFC,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X0F,0XFF,0X8F,0XFF,0XFF,0XFE,0X3F,0XFE,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X0F,0XFC,0X03,0XFF,0XFF,0XF0,0X07,0XFE,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X0F,0XF8,0X00,0XFF,0XFF,0XE0,0X07,0XFE,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X0F,0XF8,0X00,0X3F,0XFF,0X80,0X03,0XFE,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X0F,0XFC,0X00,0X7F,0XFF,0XC0,0X07,0XFE,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X0F,0XFC,0X01,0XFF,0XFF,0XF0,0X0F,0XFE,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X07,0XFF,0X07,0XFF,0XFF,0XFC,0X1F,0XFE,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X07,0XFF,0XC7,0XFF,0XFF,0XF8,0X7F,0XFC,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X03,0XFF,0XE1,0XFF,0X1F,0XF1,0XFF,0XF8,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0XFF,0XF8,0X7C,0X0F,0XC3,0XFF,0XE0,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X7F,0XFE,0X10,0X03,0X0F,0XFF,0XC0,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X1F,0XFF,0X00,0X00,0X3F,0XFF,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X7E,0X00,0X00,0X07,0XFF,0XC0,0X00,0X7F,0XFC,0X00,0X00,0X0F,0X80,0X00,
0X00,0X07,0XFF,0XF0,0X00,0X63,0XFF,0XF0,0X01,0XFF,0XF0,0XC0,0X01,0XFF,0XFC,0X00,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0XFC,0X01,0XF0,0XFF,0XF8,0X07,0XFF,0XE1,0XE0,0X07,0XFF,0XFF,0X00,
0X00,0X07,0XFF,0XE0,0X00,0X43,0XFF,0XE0,0X01,0XFF,0XF8,0XC0,0X00,0XFF,0XF8,0X00,
0X00,0X00,0X00,0X00,0X00,0X0F,0XFF,0XC0,0X00,0X7F,0XFC,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X1F,0XFF,0X00,0X00,0X3F,0XFF,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X7F,0XFC,0X30,0X03,0X0F,0XFF,0XC0,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X01,0XFF,0XF8,0XFC,0X0F,0XC3,0XFF,0XE0,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X03,0XFF,0XE1,0XFF,0X3F,0XF1,0XFF,0XF8,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X07,0XFF,0X87,0XFF,0XFF,0XF8,0X7F,0XFC,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X0F,0XFF,0X07,0XFF,0XFF,0XFC,0X1F,0XFC,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X0F,0XFC,0X01,0XFF,0XFF,0XF0,0X0F,0XFE,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X1F,0XF8,0X00,0X7F,0XFF,0XC0,0X07,0XFE,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X1F,0XF8,0X00,0X7F,0XFF,0X80,0X03,0XFE,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X0F,0XF8,0X00,0XFF,0XFF,0XE0,0X07,0XFE,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X0F,0XFC,0X03,0XFF,0XFF,0XF0,0X0F,0XFE,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X0F,0XFF,0X9F,0XFF,0XFF,0XFE,0X7F,0XFC,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X07,0XFF,0XFF,0XFF,0X3F,0XFF,0XFF,0XFC,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X03,0XFF,0XFF,0XFC,0X0F,0XFF,0XFF,0XF0,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0XFF,0XFF,0XF8,0X03,0XFF,0XFF,0XE0,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X3F,0XFF,0XE0,0X00,0XFF,0XFF,0X80,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X07,0XFE,0X00,0X00,0X1F,0XFC,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,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,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,0X00,0X00,0X00,0X00,0X00,0X00,0X00
};

flash unsigned char tab2[]={
/*--  调入了一幅图像:移动图标 123456.bmp  --*/
/*--  宽度x高度=128x64  --*/
0X00,0X00,0X00,0X00,0X00,0X00,0X0F,0XFF,0XFF,0XF8,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X0F,0XFF,0XFF,0XFF,0XFF,0XF0,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X01,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XC0,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X3F,0XFF,0XFF,0XF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FF,0XFF,0XFF,0XFF,0XFF,0XFF,0XC0,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X3F,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XFC,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X03,0XFF,0XFF,0XFF,0XFF,0XFF,0XFF,0XE0,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X1F,0XFF,0XFF,0XFF,0XFF,0XF8,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X3F,0XFF,0XFF,0XFE,0X00,0X00,0X00,0X00,0X00,0X00,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0XCF,0XE6,0X00,0X00,0X00,0X00,0X00,0X00,0X00
};
flash unsigned char tab3[]={
/*--  调入了一幅图像:移动图标 1234.bmp  --*/
/*--  宽度x高度=64x64  --*/
0X00,0X00,0X00,0X3F,0XFE,0X00,0X00,0X00,0X00,0X00,0X03,0XFF,0XFF,0XC0,0X00,0X00,
0X00,0X00,0X0F,0XFF,0XFF,0XF8,0X00,0X00,0X00,0X00,0X7F,0XFF,0XFF,0XFE,0X00,0X00,
0X00,0X00,0XFF,0XFF,0XFF,0XFF,0X80,0X00,0X00,0X03,0XFF,0XFF,0XFF,0XFF,0XC0,0X00,
0X00,0X07,0XFF,0XF0,0X07,0XFF,0XF0,0X00,0X00,0X0F,0XFF,0XE0,0X01,0XFF,0XF8,0X00,
0X00,0X1F,0XFF,0X80,0X00,0XFF,0XFC,0X00,0X00,0X7F,0XFF,0X00,0X00,0X7F,0XFE,0X00,
0X00,0X7F,0XFE,0X00,0X00,0X1F,0XFF,0X00,0X00,0XFF,0XFC,0X00,0X78,0X0F,0XFF,0X80,
0X01,0XFF,0XF0,0X01,0XFE,0X07,0XFF,0XC0,0X03,0XFF,0XE0,0X03,0XFF,0X83,0XFF,0XC0,
0X03,0XFF,0XC0,0X0F,0XFF,0XC0,0XFF,0XE0,0X07,0XFF,0X80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0XC0,0XF8,0X00,0X07,0XC0,0X07,0XFC,0X1F,0XF0,0X3E,0X00,0X0F,0X80,0X0F,0XFC,
0X1F,0XF8,0X1F,0X00,0X3F,0X00,0X1F,0XF8,0X0F,0XFC,0X0F,0X80,0X7E,0X00,0X3F,0XF8,
0X0F,0XFE,0X07,0XE1,0XFC,0X00,0XFF,0XF0,0X07,0XFF,0X81,0XFF,0XF8,0X01,0XFF,0XF0,
0X07,0XFF,0XC0,0XFF,0XE0,0X03,0XFF,0XE0,0X03,0XFF,0XE0,0X7F,0XC0,0X07,0XFF,0XE0,
0X01,0XFF,0XF0,0X3F,0X80,0X1F,0XFF,0XC0,0X00,0XFF,0XF8,0X00,0X00,0X3F,0XFF,0X80,
0X00,0XFF,0XFE,0X00,0X00,0X7F,0XFF,0X00,0X00,0X7F,0XFF,0X00,0X00,0XFF,0XFE,0X00,
0X00,0X3F,0XFF,0X80,0X01,0XFF,0XFC,0X00,0X00,0X1F,0XFF,0XC0,0X07,0XFF,0XF8,0X00,
0X00,0X07,0XFF,0XF0,0X0F,0XFF,0XF0,0X00,0X00,0X03,0XFF,0XFC,0X3F,0XFF,0XE0,0X00,
0X00,0X01,0XFF,0XFF,0XFF,0XFF,0X80,0X00,0X00,0X00,0X7F,0XFF,0XFF,0XFE,0X00,0X00,
0X00,0X00,0X1F,0XFF,0XFF,0XFC,0X00,0X00,0X00,0X00,0X03,0XFF,0XFF,0XE0,0X00,0X00,
0X00,0X00,0X00,0X7F,0XFF,0X00,0X00,0X00,0X00,0X00,0X00,0X0B,0XD0,0X00,0X00,0X00
};

flash unsigned char tab4[]={
/*--  调入了一幅图像:联通图标 45678.bmp  --*/
/*--  宽度x高度=64x64  --*/
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,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,0X00,0X00,0X00,0X00,0X00,0X00,0X01,0XF0,0X03,0XE0,0X00,0X00,
0X00,0X00,0X07,0XFC,0X0F,0XF8,0X00,0X00,0X00,0X00,0X0F,0XFE,0X1F,0XFC,0X00,0X00,
0X00,0X00,0X1F,0XFF,0X3F,0XFE,0X00,0X00,0X00,0X00,0X1F,0XFF,0XFF,0XFE,0X00,0X00,
0X00,0X00,0X1F,0XBF,0XFF,0X7E,0X00,0X00,0X00,0X00,0X3E,0X1F,0XFC,0X1F,0X00,0X00,
0X00,0X00,0X3E,0X0F,0XFC,0X1F,0X00,0X00,0X00,0X00,0X3E,0X07,0XF8,0X1F,0X00,0X00,
0X00,0X00,0X3E,0X07,0XF8,0X1F,0X00,0X00,0X00,0X00,0X3E,0X0F,0XFC,0X3F,0X00,0X00,
0X00,0X00,0X1F,0X1F,0XFE,0X3E,0X00,0X00,0X00,0X00,0X1F,0X9F,0XFE,0X7E,0X00,0X00,
0X00,0X00,0X0F,0XCF,0X3C,0XFC,0X00,0X00,0X00,0X00,0X0F,0XE6,0X19,0XFC,0X00,0X00,
0X00,0X00,0X07,0XF0,0X13,0XF8,0X00,0X00,0X00,0X00,0X03,0XF0,0X07,0XF0,0X00,0X00,
0X00,0X70,0X01,0XF8,0X07,0XE0,0X03,0X80,0X01,0XFC,0X0C,0XFC,0X0F,0XC8,0X0F,0XE0,
0X07,0XFE,0X0C,0XFE,0X1F,0XCC,0X1F,0XF0,0X07,0XFF,0X1E,0X7F,0X3F,0X9E,0X3F,0XF8,
0X0F,0XFF,0XBF,0X3F,0XFF,0X3F,0X7F,0XFC,0X0F,0XFF,0XFF,0X1F,0XFE,0X3F,0XFF,0XFC,
0X1F,0X8F,0XFE,0X0F,0XFC,0X1F,0XFC,0X7E,0X1F,0X07,0XFC,0X0F,0XF8,0X0F,0XF8,0X3E,
0X1F,0X03,0XF8,0X07,0XF8,0X07,0XF0,0X3E,0X1F,0X03,0XF8,0X07,0XF8,0X07,0XF0,0X3E,
0X1F,0X07,0XFC,0X0F,0XFC,0X0F,0XF8,0X3E,0X1F,0X8F,0XFE,0X1F,0XFC,0X1F,0XFC,0X7E,
0X0F,0XFF,0XFF,0X1F,0XFE,0X3F,0XFF,0XFC,0X0F,0XFF,0XBF,0X3F,0X7F,0X3F,0X7F,0XFC,
0X07,0XFF,0X1E,0X7F,0X3F,0X9E,0X3F,0XF8,0X03,0XFE,0X0C,0XFE,0X1F,0XCC,0X1F,0XF0,
0X01,0XFC,0X01,0XFC,0X0F,0XE8,0X0F,0XE0,0X00,0X00,0X03,0XF8,0X07,0XE0,0X00,0X00,
0X00,0X00,0X03,0XF0,0X07,0XF0,0X00,0X00,0X00,0X00,0X07,0XE4,0X13,0XF8,0X00,0X00,
0X00,0X00,0X0F,0XEE,0X39,0XFC,0X00,0X00,0X00,0X00,0X1F,0XCF,0X7C,0XFC,0X00,0X00,
0X00,0X00,0X1F,0X9F,0XFE,0X7E,0X00,0X00,0X00,0X00,0X3F,0X1F,0XFE,0X3E,0X00,0X00,
0X00,0X00,0X3E,0X0F,0XFC,0X3F,0X00,0X00,0X00,0X00,0X3E,0X07,0XF8,0X1F,0X00,0X00,
0X00,0X00,0X3E,0X07,0XF8,0X1F,0X00,0X00,0X00,0X00,0X3E,0X0F,0XFC,0X1F,0X00,0X00,
0X00,0X00,0X3E,0X1F,0XFC,0X3F,0X00,0X00,0X00,0X00,0X3F,0XBF,0XFF,0X7E,0X00,0X00,
0X00,0X00,0X1F,0XFF,0X7F,0XFE,0X00,0X00,0X00,0X00,0X1F,0XFE,0X3F,0XFC,0X00,0X00,
0X00,0X00,0X0F,0XFE,0X1F,0XFC,0X00,0X00,0X00,0X00,0X07,0XFC,0X0F,0XF8,0X00,0X00,
0X00,0X00,0X01,0XF0,0X03,0XE0,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,
0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00
};

void main(void)
{
  delay_ms(200); 
  PORTB = 0xff;
  DDRB = 0xff;        // PB.7输出,作为运行标志
  init_lcd();         // LCD初始化,并清屏   
  LcdClearTXT();      // 文本区RAM清零
  LcdClearBMP();      // 图形区RAM清零
  run = 0;            // 运行标志亮
  while(1)
  { 
    
    hz_disp();        // 显示汉字或字母
    LcdClearTXT();    // 文本区RAM清零
    
    lcdfill(0xff);    // 显示全亮
    delay_ms(3000);

    Disp_H_Line();    // 显示横条
    delay_ms(3000);

    lcdfill(0xaa);    // 显示竖条
    delay_ms(3000);

    frame();          // 显示边框
    delay_ms(3000);

    img_disp(tab);    // 显示联通图标128*64
    delay_ms(3000);

    img_disp(tab2);   // 显示移动图标128*64
    delay_ms(3000);

    img_disp2(tab3);  // 显示移动图标64*64
    img_disp3(tab4);  // 显示联通图标64*64
    delay_ms(3000);

    LcdClearBMP();    // 图形区RAM清零
  }
}
/*------------------LCD初始化-----------------*/
void init_lcd(void)

  PORTD = 0xff;
  PORTC = 0xff;
  DDRD = 0xff;   // PD输出,控制线
  DDRC = 0xff;   // PC输出,数据线
  rst = 0;
  delay_us(50);
  rst = 1; 
  delay_us(100);
  psb = 1;       // 并行
  wr_comm(0x30); // 基本指令,8位数据模式
  delay_us(3);
  wr_comm(0x0C); // 显示开,游标关,反白关
  delay_us(3);
  wr_comm(0x01); // 清除显示,并且设定地址指针为00H
  delay_us(3);
  wr_comm(0x06); // 指定在资料的读取及写入时,设定游标的移动方向及指定显示的移位
}
/*--------------检测LCD忙闲---------------*/
void chk_busy(void)

  LCD_Bus = 0xff;
  rs = 0;
  rw = 1;
  delay_us(2);
  e = 1; 
  DDRC &= ~(1<   delay_us(2); 
  while((PINC&(1<   e = 0; 
  DDRC |= 1<   delay_us(2);
}
/*------------写命令到LCD--------------*/
void wr_comm(unsigned char comm)
{
  chk_busy();
  rs = 0;//H:写数据,L:写指令
  rw = 0;
  e = 0;
  delay_us(2);
  LCD_Bus = comm;//内容
  delay_us(3);
  e = 1;
  delay_us(2);
  e = 0;
}
/*------------写数据到LCD--------------*/
void wr_data(unsigned char dat)
{
  chk_busy();
  rs = 1;//H:写数据,L:写指令
  rw = 0;
  e = 0;
  delay_us(2);
  LCD_Bus = dat;//内容
  delay_us(3);
  e = 1;
  delay_us(2);
  e = 0;
}
/*-------向LCD写一个字符串,长度64字符之内---------- */
void wr_str(unsigned char flash *s)
{
   while(*s>0)
   {
      wr_data(*s);
      s++;
   }
}   
/*------------显示汉字或字母--------------*/
void hz_disp(void)
{  
   wr_comm(0x30); // 基本指令,8位数据模式
   wr_comm(0x01); // 清除显示,并且设定地址指针为00H

   /*-显示4行汉字-*/
   wr_comm(0x80);     // 第 1 行
     wr_str(ex1); 
   wr_comm(0x90);     // 第 2 行
     wr_str(ex2);
   wr_comm(0x88);     // 第 3 行
     wr_str(ex3);
   wr_comm(0x98);     // 第 4 行
     wr_str(ex4);  
   run = 1;
   delay_ms(3000);    // 延时
   wr_comm(0x01);     // 清除显示
   /*-显示4行汉字-*/
   wr_comm(0x80);
     wr_str(ex5);
   wr_comm(0x90);
     wr_str(ex6);
   wr_comm(0x88);
     wr_str(ex7);
   wr_comm(0x98);
     wr_str(ex8);  
   run = 0;
   delay_ms(3000);
   wr_comm(0x01);     // 清除显示
   /*-显示2行字母-*/
   wr_comm(0x80);
     wr_str(ex9);  
   wr_comm(0x88);
     wr_str(ex10);
   delay_ms(3000);  
   wr_comm(0x01);     // 清除显示
}
/*-------------------------- 显示图片,128*64 --------------------------- */
void img_disp(unsigned char flash *img)
{
  unsigned char i,x,y;
  unsigned int j=0;
  for(i=0;i<9;i=i+8)       // i=0,控制上半屏,i=8,控制下半屏
  {
    for(y=0;y<32;y++)      // y控制行地址
    {
      for(x=0;x<8;x++)     // x控制列地址
      {
        wr_comm(0x36);     // 功能设置:8位控制界面,扩充指令集,绘图显示开
        wr_comm(0x80+y);   // 行地址
        wr_comm(0x80+x+i); // 列地址  x+i=0~7, 上半屏,x+i=8~15,下半屏
        wr_data(img[j++]); // 高字节
        wr_data(img[j++]); // 低字节
        wr_comm(0x30);     // 功能设置:8位控制界面,基本指令集,绘图显示关
      }
    }
  }
}         
/*------------------------ 显示图片,64*64 --------------------------- */
void img_disp2(unsigned char flash *img)   // 左半屏
{
  unsigned char i,x,y;
  unsigned int j=0;
  for(i=0;i<9;i=i+8)       // i=0,控制上半屏,i=8,控制下半屏
  {
    for(y=0;y<32;y++)      // y控制行地址
    {
      for(x=0;x<4;x++)     // x控制列地址
      {
        wr_comm(0x36);     // 功能设置:8位控制界面,扩充指令集,绘图显示开
        wr_comm(0x80+y);   // 行地址
        wr_comm(0x80+x+i); // 列地址  x+i=0~7, 上半屏,x+i=8~15,下半屏
        wr_data(img[j++]); // 高字节
        wr_data(img[j++]); // 低字节
        wr_comm(0x30);     // 功能设置:8位控制界面,基本指令集,绘图显示关
      }
    }
  }
}
/*----------------------- 显示图片,64*64 ----------------------------- */
void img_disp3(unsigned char flash *img)    //  右半屏
{
  unsigned char i,x,y;
  unsigned int j=0;
  for(i=0;i<9;i=i+8)       // i=0,控制上半屏,i=8,控制下半屏
  {
    for(y=0;y<32;y++)      // y控制行地址
    {
      for(x=4;x<8;x++)     // x控制列地址
      {
        wr_comm(0x36);     // 功能设置:8位控制界面,扩充指令集,绘图显示开
        wr_comm(0x80+y);   // 行地址
        wr_comm(0x80+x+i); // 列地址  x+i=0~7, 上半屏,x+i=8~15,下半屏
        wr_data(img[j++]); // 高字节
        wr_data(img[j++]); // 低字节
        wr_comm(0x30);     // 功能设置:8位控制界面,基本指令集,绘图显示关
      }
    }
  }
}
/*--------------  整屏填充,全亮,或者竖条  ---------------------- */
void lcdfill(unsigned char disdata)  //整屏写入数据:全亮,或者竖条
{
  unsigned char x,y;
  for(y=0;y<32;y++)
  {
    for(x=0;x<16;x++)
    {
      wr_comm(0x36);
      wr_comm(y+0x80);     // 行地址
      wr_comm(x+0x80);     // 列地址
      wr_comm(0x30);
      wr_data(disdata);
      wr_data(disdata);
    }
    wr_comm(0x34);
    wr_comm(0x36);
  }
}
/*---------------------- 显示横条 -----------------------------*/
void Disp_H_Line(void)
{  unsigned char x,y;
   unsigned char k=0x00;
   for(y=0;y<32;y++)
   { k=~k;
     for(x=0;x<16;x++)
     {
       wr_comm(0x36);
       wr_comm(y+0x80);     // 行地址
       wr_comm(x+0x80);     // 列地址
       wr_comm(0x30);
       wr_data(k);
       wr_data(k);
     }
   }
   wr_comm(0x34);
   wr_comm(0x36);
}
/*------------------ 显示边框 -------------------------------*/
void frame(void)
{
  unsigned char x,y;
  lcdfill(0x00);
  for(x=0;x<9;x+=8)
  {
    for(y=0;y<32;y++)
    {
      wr_comm(0x36);
      wr_comm(y+0x80);      // 行地址
      wr_comm(x+0x80);      // 列地址
      wr_comm(0x30);
      wr_data(0x80);
      wr_data(0x00);

      wr_comm(0x36);
      wr_comm(y+0x80);      // 行地址
      wr_comm(x+0x87);      // 列地址
      wr_comm(0x30);
      wr_data(0x00);
      wr_data(0x01);
    }
  }
  for(y=0;y<2;y++)
  {
    for(x=0;x<8;x++)
    {
      wr_comm(0x36);
      wr_comm(y*31+0x80);   // 行地址
      wr_comm(x+0x80+8*y);  // 列地址
      wr_comm(0x30);
      wr_data(0xff);
      wr_data(0xff);
    }
  }
  wr_comm(0x34);
  wr_comm(0x36);
}
/*----------------文本区清RAM函数----------------*/
void LcdClearTXT(void)
{
   unsigned char i;
   wr_comm(0x30);      // 8BitMCU,基本指令集合
   wr_comm(0x80);      // AC归起始位
   for(i=0;i<64;i++)
     wr_data(0x20);

/*-----------------图形区清RAM函数-----------------*/
void LcdClearBMP(void)
{
   unsigned char i,j;
   wr_comm(0x34);        // 8Bit扩充指令集,即使是36H也要写两次
   wr_comm(0x36);        // 绘图ON,基本指令集里面36H不能开绘图
   for(i=0;i<32;i++)     // 12864实际为256x32
   {
     wr_comm(0x80|i);    // 行位置
     wr_comm(0x80);      // 列位置
     for(j=0;j<32;j++)   // 256/8=32 byte
       wr_data(0);
   }
}

关键字:带字库  并行方式显示  AVR程序 引用地址:12864(带字库)并行方式显示汉字和图形-CVAVR程序

上一篇:12864(带字库)串行方式显示汉字和字库-CVAVR程序
下一篇:tlc1549 CVAVR程序

推荐阅读最新更新时间:2024-03-16 15:18

avr单片机 PWM调速程序及原理图
源程序: #include iom16v.h #include macros.h #define uint unsigned int #define uchar unsigned char #define Left OCR1A #define Right OCR1B #define ADD 1.15; //宏定义,加速系数 uchar i; uchar flag; //是否减速标志位 uchar TCRT5000_IN; uint Max_Speed; uchar Min_Speed; /************************************************* 函数名称:Init
[单片机]
nRF24L01 AVR 发送接收驱动程序
#include #include #include 12864.h 智芯锐电子技术社区:http://www.zhixinrui.com //------------------------------------------------------------------------------ //spi标志 #define DDR_SPI DDRB #define DD_MOSI 5 #define DD_MISO 6 #define DD_SCK 7 #define DD_SS 4 #define CE PB3 #define IRQ PB2 //----------
[单片机]
实现AVR单片机芯片程序自刷 USB_Flash_BootLoader HID制作过程
前期制作USBASP过程中,学习了AVR单片机芯片的BootLoader原理,查找了很多关于USB-HID和BootLoader的资料制作了可以自刷程序的atmega8(16)简易板,现将所学的分享给大家。 一、关于BootLoader BootLoader是芯片上电后,程序不从flash地址的0x00执行,而是跳转到boot区执行bootloader程序。 atmega8的boot区的大小及起始位置是由其熔丝位来设置(BOOTSZ0、BOOTSZ1)的。 其是否执行bootloader程序也是由熔丝位(BOOTRST)设置的。 二、关于USB-HID HID是人体学输入设备的英文简称,由于
[单片机]
实现<font color='red'>AVR</font>单片机芯片<font color='red'>程序</font>自刷 USB_Flash_BootLoader HID制作过程
单片机控制12864显示动态图片
仿真电路图: 仿真效果展示: C语言仿真程序: #include reg51.h #define uchar unsigned char #define uint unsigned int #define Left() {LCD_CS1=0;LCD_CS2=1;} //通用 #define Right() {LCD_CS1=1;LCD_CS2=0;} //通用 #define All() {LCD_CS1=0;LCD_CS2=0;} #define CMD 0 #define DATA 1 sbit LCD_RS=P2^2; sbit LCD_RW=P2^1; sbit LCD_E
[单片机]
单片机控制<font color='red'>12864</font><font color='red'>显示</font>动态图片
轻松玩转LCD12864-基于AVR单片机的LCD12864串行显示
LCD12864是一种常用的图形液晶显示模块,顾名思义,就是可以在水平方向显示128个点,在竖直方向显示64个点。通过对控制芯片写入数据,可以控制点的亮灭,从而显示字符、数字、汉字或者自定义的图形。尽管LCD12864有各个不同厂家生产的产品,控制芯片和引脚定义也不尽相同,但是控制原理都大同小异。本文是对我个人使用LCD12864的经验做一个总结,希望能对入门者起到抛砖引玉的作用。 就以深圳市亚晶达电子有限公司生产的YJD12864C-1为例,我不想深究显示屏的内部结构,单讲讲各个引脚的作用以及数据读写时的时序。 上图是YJD12864C-1的实物图,从右往左,1脚到20脚的定义如下: 1:VSS,接地端 2:VDD,电源
[单片机]
轻松玩转LCD<font color='red'>12864</font>-基于<font color='red'>AVR</font>单片机的LCD<font color='red'>12864</font>串行<font color='red'>显示</font>
PCF8563时钟+AT24C02+LCD12864显示时钟程序
//aa 00 47 13 25 63 00 04 04 //秒 分 时 日 星期和月(最高3位0-6,代表1-7) #include intrins.h #include AT89x52.h #include hc LCD dot.h //点阵库 #define Uchar unsigned char #define Uint unsigned int #define SomeNOP(); _nop_();_nop_();_nop_(); /*LCD驱动要用到的一些口线定意*/ #define LCDPORT P0 sbit D_I = P3^7; sbit R_W = P3^6; sbit E = P3^5
[单片机]
超声波测距-AVR程序代码
#include #include #define uchar unsigned char #define uint unsigned int uchar int_flag; uint qian,bai,shi,ge; uint i; float distance; // Alphanumeric LCD Module functions #asm .equ __lcd_port=0x18 ;PORTB #endasm #include // External Interrupt 0 service routine interrupt void ext_int0_isr(void) {#asm( sei ) if
[单片机]
迁移51 的 LCD12864 到 Stm32F407
假期参加电赛崩了。。。闲的无聊,准备做一些底层的代码分享一下,也算是给自己磨炼一下吧。 这次做的是Stm32F407ZGT6 驱动LCD12864 的代码测试的时候使用的是正点原子的探索者 STM32F4开发板、 LCD 插在清翔的51单片机开发板上注意我是用的是 带有中文字库的版本 这里注意驱动LCD需要给模块一个参考电压也就是上图的VO否则LCD显示会出异常(颜色过深或者过浅) 我也是因为这个 所以才使用了成品开发板的电路 程序是从51单片机的程序上迁移过来的,咱们不做深究,只是注重一些迁移的细节。 以上是三个控制引脚的设置,其实还有几个是PSB需要设置,这个是一直拉高我就没用IO了 就直接接到VCC了
[单片机]
迁移51 的 LCD<font color='red'>12864</font> 到 Stm32F407
小广播
添点儿料...
无论热点新闻、行业分析、技术干货……
热门活动
换一批
更多
设计资源 培训 开发板 精华推荐

最新单片机文章
何立民专栏 单片机及嵌入式宝典

北京航空航天大学教授,20余年来致力于单片机与嵌入式系统推广工作。

更多每日新闻
随便看看
电子工程世界版权所有 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号 Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved