4.jpg (295.3 KB, 下載次數(shù): 37)
下載附件
2018-4-14 22:28 上傳
3.jpg (295.32 KB, 下載次數(shù): 32)
下載附件
2018-4-14 22:28 上傳
2.jpg (327.09 KB, 下載次數(shù): 35)
下載附件
2018-4-14 22:28 上傳
1.jpg (419.77 KB, 下載次數(shù): 23)
下載附件
2018-4-14 22:28 上傳
單片機源程序如下:
- #include"reg52.h"
- #include"math.h"
- #include"intrins.h"
- #include"function.h"
- #define DB P0
- sbit RS = P1^4;
- sbit RW = P1^5;
- sbit E = P1^6;
- uchar code logo[] = {
- /*-- 調入了一幅圖像:I:\液晶屏BMP圖\菜單.bmp --*/
- /*-- 寬度x高度=128x64 --*/
- 0x00,0x00,0x00,0x20,0x20,0x08,0x20,0x20,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x20,0x17,0xFC,0x13,0xF0,0x3F,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x78,0x20,0x50,0x08,0x12,0x20,0x24,0x90,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x10,0x00,0x4B,0xFC,0x40,0x08,0x02,0x20,0x3F,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x70,0x00,0x48,0x20,0x47,0xC8,0x02,0x1C,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x10,0x00,0x48,0x20,0x44,0x48,0xF4,0x00,0x7F,0xFC,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x10,0x00,0x79,0x20,0x44,0x48,0x1B,0xF0,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x10,0x00,0x48,0xA0,0x47,0xC8,0x11,0x10,0x1F,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x10,0x00,0x48,0xA0,0x44,0x48,0x11,0x10,0x10,0x20,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x10,0x00,0x48,0x20,0x44,0x48,0x14,0xA0,0x1F,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x10,0x00,0x78,0x20,0x47,0xC8,0x18,0x40,0x10,0x20,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x10,0x60,0x48,0x20,0x40,0x08,0x10,0xA0,0x1F,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x7C,0x60,0x40,0xA0,0x40,0x28,0x03,0x1C,0x10,0x20,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x00,0x40,0x40,0x10,0x0C,0x08,0xFF,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,0x10,0x00,0x10,0x20,0x20,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x1F,0xF8,0x3F,0xF8,0x13,0xF0,0x3F,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x10,0x10,0x00,0x00,0x12,0x20,0x24,0x90,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x3C,0x00,0x1F,0xF0,0x00,0x00,0x02,0x20,0x3F,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x42,0x00,0x10,0x10,0x00,0x08,0x02,0x1C,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x42,0x00,0x1F,0xF0,0x7F,0xFC,0xF4,0x00,0x7F,0xFC,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x02,0x00,0x10,0x10,0x01,0x00,0x1B,0xF0,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x04,0x00,0x04,0x80,0x09,0x40,0x11,0x10,0x1F,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x08,0x00,0x44,0x88,0x09,0x20,0x11,0x10,0x10,0x20,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x10,0x00,0x24,0x90,0x11,0x10,0x14,0xA0,0x1F,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x20,0x00,0x14,0xA0,0x21,0x08,0x18,0x40,0x10,0x20,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x42,0x60,0x14,0xC0,0x41,0x08,0x10,0xA0,0x1F,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x7E,0x60,0x04,0x88,0x05,0x00,0x03,0x1C,0x10,0x20,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0xFF,0xFC,0x02,0x00,0x0C,0x08,0xFF,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,0x08,0x40,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x1C,0x40,0x02,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0xF0,0x40,0x7F,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x3C,0x00,0x11,0x50,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x42,0x00,0xFD,0x48,0x3F,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x42,0x00,0x11,0x44,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x04,0x00,0x32,0x44,0xFF,0xFC,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x18,0x00,0x3A,0x40,0x05,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x04,0x00,0x52,0x48,0x09,0x10,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x02,0x00,0x50,0x10,0x18,0xA0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x42,0x00,0x90,0x20,0x28,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x42,0x60,0x10,0x40,0xC9,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x3C,0x60,0x11,0x80,0x0A,0x1C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x16,0x00,0x0C,0x08,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,0x20,0x08,0x20,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x17,0xFC,0x20,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x48,0x08,0x3C,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x08,0x00,0x42,0x08,0x41,0xFC,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x08,0x00,0x5F,0xE8,0x41,0x24,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x18,0x00,0x42,0x08,0xF9,0x24,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x28,0x00,0x4F,0xC8,0xA1,0x24,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x48,0x00,0x4A,0x48,0x21,0xFC,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x48,0x00,0x4A,0x48,0xFD,0x24,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x7E,0x00,0x4A,0x48,0x20,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x08,0x00,0x4A,0xC8,0x20,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x08,0x60,0x42,0x08,0x28,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x1E,0x60,0x42,0x28,0x30,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
- 0x00,0x00,0x40,0x10,0x20,0x20,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,
- };
- /************************************************************************************
- 查忙函數(shù)
- ************************************************************************************/
- void busy(void)//RS=0;RW=1;wait=0閑;wait!=0忙
- {
- uchar wait;
- RS = 0;
- RW = 1;
- E = 1;
- for(;;)
- {
- wait = DB;
- wait &= 0x80;
- if(wait == 0)break;
- }
- E = 0;
- }
- /************************************************************************************
- 寫指令函數(shù)
- ************************************************************************************/
- void w_code(uchar c)//RS=0;RW=0;E下降沿
- {
- busy();
- RS = 0;
- RW = 0;
- DB = c;
- E = 1;
- E = 0;
- DB = 0xff;
- }
- /************************************************************************************
- 寫數(shù)據(jù)函數(shù)
- ************************************************************************************/
- void w_data(uchar d)//RS=1;RW=0;E下降沿
- {
- busy();
- RS = 1;
- RW = 0;
- DB = d;
- E = 1;
- E = 0;
- DB = 0xff;
- }
- /************************************************************************************
- 讀數(shù)據(jù)函數(shù)
- ************************************************************************************/
- uchar r_data(void)//RS=1;RW=1;E下降沿
- {
- uchar rd_lcd;
- busy();
- RS = 1;
- RW = 1;
- E = 1;
- rd_lcd = DB;
- E = 0;
- return rd_lcd;
- }
- /************************************************************************************
- 寫DGRAM:x_lcd橫坐標,y_lcd縱坐標
- ************************************************************************************/
- void address(uchar x_lcd,uchar y_lcd)//
- {
- w_code(y_lcd);//垂直坐標
- w_code(x_lcd);//水平坐標
- }
- /************************************************************************************
- 初始化液晶屏
- 0:字庫 1:繪圖
- ************************************************************************************/
- void lcd_rst(bit a)
- {
- if(a)
- {
- w_code(0x01);// 清屏
- w_code(0x32);// 功能設置---8BIT控制界面,繪圖顯示ON
- w_code(0x36);// 功能設置---8BIT控制界面,擴充指令集
- }
- else
- {
- w_code(0x30);// 功能設置---8BIT控制界面,基本指令集
- w_code(0x0c);//顯示打開,光標關,反白顯示關
- w_code(0x01);// 清除屏幕顯示,將DDRAM的地址計數(shù)器歸零
- }
- }
- /************************************************************************************
- ---------------------------寫整屏點陣數(shù)據(jù)
- ---------------------------x :圖像數(shù)據(jù)的起始地址
- ************************************************************************************/
- void write_lcd_full(uint x )
- {
- uchar i,j,a;
- j = 0x80; //Y地址寄存器
- for(a = 0;a < 32;a++)
- {
- w_code(j);
- j++;
- w_code(0x80);//X地址寄存器
- for(i = 0;i < 16;i ++)
- {
- w_data(logo[x]);
- x++;
- }
- }
- j = 0x80; //Y地址寄存器
- for(a = 0;a < 32;a++)
- {
- w_code(j);
- j++;
- w_code(0x88);//X地址寄存器
- for(i = 0;i < 16;i ++)
- {
- w_data(logo[x]);
- x++;
- }
- }
- }
復制代碼
所有資料51hei提供下載:
0-30V 4A數(shù)控穩(wěn)壓電源圖.pdf
(68.11 KB, 下載次數(shù): 18)
2018-4-14 22:30 上傳
點擊文件名下載附件
下載積分: 黑幣 -5
|