完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
扫一扫,分享给好友
#include #define Disp_On 0x3f //开显示 #define Disp_Off 0x3e //关显示 #define Col_Add 0x40 // #define Page_Add 0xb8 //页起始地址 #define Start_Line 0xc0 //行起始地址 #define Lcd_Bus P0 // MCU P0<------> LCM ***it Di =P1^0; //Data or Instrument Select RS ***it RW =P1^1; //Write or Read R/W ***it Enable =P1^2; //6800 mode Enable single E ***it Mcs =P1^3; //Master chip enable CS1 ***it Scs =P1^4; //Slave chip enable CS2 unsigned char i; char code wang[]= { 0x00,0x02,0x82,0x82,0x82,0x82,0x82,0xFE,0x82,0x82,0x82,0x82,0xC3,0x82,0x00, 0x00,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x3F,0x20,0x20,0x20,0x20,0x20,0x30,0x20,0x00 }; char code jun[]= { 0x00,0x18,0x26,0x22,0xA2,0x72,0x2E,0xAA,0x22,0x22,0x22,0x32,0x22,0x0A,0x06,0x00,0x00,0x10, 0x10,0x12,0x13,0x12,0x12,0xFF,0x12,0x12,0x12,0x13,0x12,0x18,0x10,0x00 }; char code hua[]= { 0x20,0x10,0x08,0xFC,0x03,0x02,0x10,0x10,0x7F,0x88,0x88,0x84,0x86,0xE4,0x00,0x00,0x00,0x04,0x04, 0x05,0x04,0x04,0x04,0xFF,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x00 }; void delay(unsigned int t) //延时子程序 { unsigned int i,j; for(i=0;i } void write_com(unsigned char cmdcode) //写指令 { Di=0; RW=0; Lcd_Bus=cmdcode; delay(5); Enable=1; delay(5); Enable=0; } void write_data(unsigned char Dispdata) //写数据 { Di=1; RW=0; Lcd_Bus=Dispdata; delay(5); Enable=1; delay(5); Enable=0; } void init_lcd() //显示初始化 { Mcs=1; Scs=1; delay(100); write_com(Disp_Off); write_com(Page_Add+0); write_com(Start_Line+0); write_com(Col_Add+0); write_com(Disp_On); } void Clr_Scr() { unsigned char j,k; Mcs=1;Scs=1; write_com(Page_Add+0); write_com(Col_Add+0); for(k=0;k<8;k++) { write_com(Page_Add+k); for(j=0;j<64;j++) write_data(0x00); } } void main() { init_lcd(); write_com(0x01); Clr_Scr(); write_com( 0xb8); write_com( 0x40); for(i=0;i<16;i++) write_data(wang); write_com( 0xb8+1); write_com( 0x40); for(i=16;i<32;i++) write_data(wang); write_com( 0xb8); write_com( 0x40+16); for(i=0;i<16;i++) write_data(jun); write_com( 0xb8+1); write_com( 0x40+16); for(i=16;i<32;i++) write_data(jun); write_com( 0xb8); write_com( 0x40+32); for(i=0;i<16;i++) write_data(hua); write_com( 0xb8+1); write_com( 0x40+32); for(i=16;i<32;i++) write_data(hua); while(1); } |
|
相关推荐 |
|
你正在撰写答案
如果你是对答案或其他答案精选点评或询问,请使用“评论”功能。
464 浏览 0 评论
478 浏览 1 评论
基于瑞萨FPB-RA4E2智能床头灯项目——1编译环境搭建与点亮驱动ws2812全彩LED
439 浏览 0 评论
嵌入式学习-飞凌嵌入式ElfBoard ELF 1板卡-LCD显示图片编程示例之介绍mmap
994 浏览 0 评论
《DNESP32S3使用指南-IDF版_V1.6》第二章 常用的C语言知识点
1056 浏览 0 评论
【youyeetoo X1 windows 开发板体验】少儿AI智能STEAM积木平台
11780 浏览 31 评论
浏览过的版块 |
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-11-25 04:15 , Processed in 0.598609 second(s), Total 74, Slave 55 queries .
Powered by 电子发烧友网
© 2015 bbs.elecfans.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号