5110液晶操作(显示图片和温度)
#include<reg52.h>
#define uchar unsigned char
#define uint unsigned int
sbit LED=P2^0;
sbit SCLK=P2^1;
sbit DN=P2^2;
sbit DC=P2^3;
sbit RST=P2^4;
sbit SCE=P2^5;
sbit K1=P1^2;
sbit K2=P1^3;
sbit K3=P1^4;
sbit DQ=P3^7;//ds18b20与单片机连接口
uchar flag;
uchar data disdata[5];
uint tvalue;//温度值
uchar tflag;//温度正负标志
//uchar A[18] = {0x00, 0x42, 0x42, 0x7e, 0x42, 0x42,0x0c,0x12,0x24,0x24,0x12,0x0c,0x00,0x7e,0x40,0x40,0x7e,0x00};
uchar A[6] ={0xc0,0xc0,0x00,0x00,0x00,0x00};
uchar A1[6] ={0x7c,0x82,0x82,0x82,0x03,0x03};
uchar A2[6] ={0x00,0x00,0x00,0x00,0x00,0x00};
uchar code tu[]={
0x00,0x00,0x00,0x80,0x80,0xC0,0xC0,0x60,0x60,0x60,0x20,0x30,0x20,0x20,0x20,0x62,
0x62,0x72,0xCC,0xF7,0xF2,0x23,0x02,0xC4,0x78,0x0C,0xE6,0xF2,0xE3,0x02,0x02,0x02,
0x07,0x0C,0x3C,0xC2,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0xF0,0xFC,0x0E,0x03,0x01,0x00,0x80,0x60,0x10,0x40,0x14,0x00,
0x00,0x00,0x00,0x00,0x20,0x38,0x18,0x58,0x19,0x59,0x23,0x03,0x07,0x0C,0x08,0x10,
0x30,0x30,0x30,0x90,0x38,0x5C,0x3F,0xF1,0xE0,0x80,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0x1F,0x3C,0x70,0xE0,0xC0,0xC2,0x8D,
0xA2,0x08,0x21,0x40,0x00,0x40,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x80,0x80,0xC0,0xE0,0x20,0x00,0x00,0x00,0x02,0x51,0x04,0xAB,0xFF,0xFE,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x0A,0x3F,0xF3,0xD7,0xAF,0x5B,0x33,0xE3,0x42,0xDF,0xE6,0x86,0x82,0x82,0x82,
0xC3,0x7E,0x43,0x63,0x21,0x31,0x18,0x06,0x81,0x00,0x00,0xA0,0x80,0xC8,0xE1,0xF4,
0x7A,0x3F,0x0F,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
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,0x03,0x07,0x07,0x0E,0x0D,0x1C,0x1D,
0x3A,0x39,0xFA,0xF8,0x7A,0xB8,0x1A,0xB8,0x1C,0xAD,0x1C,0xBE,0x1E,0xBE,0x3F,0xF3,
0xE3,0xC1,0x81,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
}; //
/*48*48点阵*/
uchar code tu1[]= {
/*-- 调入了一幅图像:C:\Users\admin\Desktop\3134714_172508056218_2.bmp --*/
/*-- 宽度x高度=48x48 --*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0xF8,0xF0,0xE0,0xC0,
0x80,0x80,0x80,0x80,0xC0,0xE0,0xFE,0xFF,0xFE,0xF0,0xC0,0x80,0x80,0x80,0x80,0xC0,
0xE0,0xF0,0xF8,0x7C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x10,0x30,0x70,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xF0,0xFF,0x7F,0x3F,0x1F,
0x0F,0x07,0x07,0x07,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x07,0x07,0x07,0x0F,
0x1F,0x1F,0x7F,0xF8,0xF0,0xF0,0xF0,0xF0,0xF0,0xF0,0x78,0x38,0x18,0x08,0x00,0x00,
0x00,0x00,0x80,0x80,0xC0,0xC0,0xE3,0xFF,0xFF,0xFF,0x1F,0x03,0x00,0x00,0x00,0x00,
0x1E,0x3F,0x3F,0x3F,0x3F,0x1E,0x00,0x00,0x00,0x00,0x1E,0x3F,0x3F,0x3F,0x3F,0x1E,
0x00,0x00,0x00,0x00,0x03,0x0F,0xFF,0xFF,0xFF,0xF0,0xE0,0xE0,0xC0,0xC0,0xC0,0xC0,
0x03,0x03,0x03,0x03,0x07,0x07,0x0F,0xDF,0xFF,0xFF,0xF8,0xC0,0x00,0x00,0x00,0x1E,
0x7C,0xF0,0xE0,0xC0,0xC0,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0xC0,0xE0,0xF0,0x7C,
0x3E,0x07,0x00,0x00,0x80,0xF0,0xFF,0xFF,0xFF,0x87,0x03,0x03,0x01,0x01,0x01,0x00,
0x00,0x00,0x00,0x38,0x18,0x1C,0x1F,0x0F,0x0F,0x0F,0x0F,0x0F,0x1F,0xFE,0xF8,0xF8,
0xF0,0xE0,0xE1,0xE1,0xC3,0xC7,0xC7,0xC7,0xC7,0xC7,0xC7,0xC3,0xC3,0xE1,0xE0,0xF0,
0xF8,0xF8,0xFC,0xFF,0x0F,0x07,0x07,0x07,0x07,0x07,0x0F,0x0E,0x0C,0x0C,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3C,0x1F,0x0F,0x07,
0x03,0x03,0x01,0x01,0x01,0x03,0x0F,0x7F,0xFF,0x7F,0x0F,0x03,0x01,0x01,0x01,0x01,
0x03,0x07,0x07,0x1F,0x3C,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
};
/*-- 宽度x高度=40x40 --*/
uchar code tu2[]={
/*0x00,0xE0,0x70,0x58,0x1C,0x86,0x12,0x82,0x01,0x03,0x01,0x02,0x02,0x02,0x00,0x06,
0x02,0x0E,0x36,0x4A,0x36,0x0E,0x02,0x04,0x04,0x02,0x02,0x00,0x03,0x01,0x01,0x93,
0x03,0x0A,0x56,0x2C,0x1C,0xB0,0xE0,0x00,0x3E,0x77,0xC0,0x60,0x30,0x18,0x08,0x04,
0xFC,0x00,0x00,0xD0,0x04,0x02,0x1D,0x3E,0x37,0x32,0x32,0xD8,0x0C,0x02,0x08,0x3E,
0x3F,0x32,0x32,0x0C,0xF0,0x00,0x0A,0xFC,0x04,0x08,0x10,0x30,0x60,0x40,0x6B,0x7E,
0x00,0x00,0x00,0x00,0x00,0xE0,0x30,0x48,0x47,0xC0,0x80,0x00,0x01,0x02,0x04,0x00,
0x3C,0x7C,0xE6,0xC2,0xE3,0xE6,0x7C,0x34,0x04,0x04,0x02,0x01,0x80,0x80,0x40,0x7F,
0x60,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x0A,0x3D,0xC8,0x88,
0x88,0x88,0xC8,0x49,0x61,0x00,0x00,0x00,0x00,0x80,0xC0,0xF0,0xC0,0x80,0x00,0x00,
0x00,0x00,0x21,0x49,0xC9,0xC8,0x88,0x88,0xE8,0x3F,0x0A,0x08,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x04,0x02,0x03,0x81,0x83,0x42,0x46,0x60,0x26,0x24,0x16,0x12,
0x16,0x0F,0x0F,0x1D,0x0D,0x1F,0x0F,0x3F,0x14,0x34,0x26,0x20,0x66,0x42,0x43,0xC1,
0x81,0x02,0x04,0x00,0x00,0x00,0x00,0x00 */
/*-- 调入了一幅图像:C:\Users\admin\Desktop\11.bmp --*/
/*-- 宽度x高度=48x48 --*/
0x00,0x00,0x80,0xC0,0xE0,0xF0,0x78,0xB8,0xBC,0xDC,0xDE,0xFF,0xEF,0xEF,0xEE,0xFE,
0xDE,0xDC,0xBC,0xB8,0x78,0xF0,0xE0,0xE0,0xE0,0xE0,0xF0,0x78,0xB8,0xBC,0xDC,0xDE,
0xEE,0xFF,0xEF,0xEF,0xFE,0xDE,0xDC,0xFC,0xB8,0x78,0xF0,0xE0,0xC0,0x80,0x00,0x00,
0xF0,0xFE,0xFF,0x0F,0xFB,0xFE,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0xFF,0xFF,0xFF,0xFF,0xFF,0xFE,0xFC,0xFB,0xFB,0xFD,0xFE,0xFF,0xFF,0xFF,0xFF,0xFF,
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFE,0xFB,0x9F,0xFF,0xFE,0xF0,
0x1F,0xFF,0xFF,0xC5,0x3F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x3F,0xE2,0xFF,0xFF,0x1F,
0x00,0x00,0x07,0x0F,0x3F,0x7C,0xF3,0xEF,0xDF,0xBF,0x7F,0xFF,0xFF,0xFF,0xFF,0xFF,
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
0xFF,0xFF,0xFF,0xFF,0xFF,0x7F,0xBF,0xDF,0xEF,0xF3,0x7C,0x3F,0x0F,0x03,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x03,0x07,0x0F,0x1F,0x3E,0x7D,0xFB,0xF7,0xEF,
0xDF,0xBF,0x7F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x7F,0xBF,0xDF,
0xEF,0xF7,0xFB,0x7D,0x3E,0x1F,0x0F,0x07,0x03,0x01,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,
0x03,0x07,0x0F,0x0E,0x1D,0x3B,0x77,0xEF,0xEF,0x77,0x3B,0x1D,0x0E,0x0F,0x07,0x03,
0x03,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
};
uchar code font6x8[][6] =
{
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 },// sp
{ 0x00, 0x00, 0x00, 0x2f, 0x00, 0x00 },// !
{ 0x00, 0x00, 0x07, 0x00, 0x07, 0x00 },// "
{ 0x00, 0x14, 0x7f, 0x14, 0x7f, 0x14 },// #
{ 0x00, 0x24, 0x2a, 0x7f, 0x2a, 0x12 },// $
{ 0x00, 0x62, 0x64, 0x08, 0x13, 0x23 },// %
{ 0x00, 0x36, 0x49, 0x55, 0x22, 0x50 },// &
{ 0x00, 0x00, 0x05, 0x03, 0x00, 0x00 },// '
{ 0x00, 0x00, 0x1c, 0x22, 0x41, 0x00 },// (
{ 0x00, 0x00, 0x41, 0x22, 0x1c, 0x00 },// )
{ 0x00, 0x14, 0x08, 0x3E, 0x08, 0x14 },// *
{ 0x00, 0x08, 0x08, 0x3E, 0x08, 0x08 },// +
{ 0x00, 0x00, 0x00, 0xA0, 0x60, 0x00 },// ,
{ 0x00, 0x08, 0x08, 0x08, 0x08, 0x08 },// -
{ 0x00, 0x00, 0x60, 0x60, 0x00, 0x00 },// .
{ 0x00, 0x20, 0x10, 0x08, 0x04, 0x02 },// /
{ 0x00, 0x3E, 0x51, 0x49, 0x45, 0x3E },// 0
{ 0x00, 0x00, 0x42, 0x7F, 0x40, 0x00 },// 1
{ 0x00, 0x42, 0x61, 0x51, 0x49, 0x46 },// 2
{ 0x00, 0x21, 0x41, 0x45, 0x4B, 0x31 },// 3
{ 0x00, 0x18, 0x14, 0x12, 0x7F, 0x10 },// 4
{ 0x00, 0x27, 0x45, 0x45, 0x45, 0x39 },// 5
{ 0x00, 0x3C, 0x4A, 0x49, 0x49, 0x30 },// 6
{ 0x00, 0x01, 0x71, 0x09, 0x05, 0x03 },// 7
{ 0x00, 0x36, 0x49, 0x49, 0x49, 0x36 },// 8
{ 0x00, 0x06, 0x49, 0x49, 0x29, 0x1E },// 9
{ 0x00, 0x00, 0x36, 0x36, 0x00, 0x00 },// :
{ 0x00, 0x00, 0x56, 0x36, 0x00, 0x00 },// ;
{ 0x00, 0x08, 0x14, 0x22, 0x41, 0x00 },// <
{ 0x00, 0x14, 0x14, 0x14, 0x14, 0x14 },// =
{ 0x00, 0x00, 0x41, 0x22, 0x14, 0x08 },// >
{ 0x00, 0x02, 0x01, 0x51, 0x09, 0x06 },// ?
{ 0x00, 0x32, 0x49, 0x59, 0x51, 0x3E },// @
{ 0x00, 0x7C, 0x12, 0x11, 0x12, 0x7C },// A
{ 0x00, 0x7F, 0x49, 0x49, 0x49, 0x36 },// B
{ 0x00, 0x3E, 0x41, 0x41, 0x41, 0x22 },// C
{ 0x00, 0x7F, 0x41, 0x41, 0x22, 0x1C },// D
{ 0x00, 0x7F, 0x49, 0x49, 0x49, 0x41 },// E
{ 0x00, 0x7F, 0x09, 0x09, 0x09, 0x01 },// F
{ 0x00, 0x3E, 0x41, 0x49, 0x49, 0x7A },// G
{ 0x00, 0x7F, 0x08, 0x08, 0x08, 0x7F },// H
{ 0x00, 0x00, 0x41, 0x7F, 0x41, 0x00 },// I
{ 0x00, 0x20, 0x40, 0x41, 0x3F, 0x01 },// J
{ 0x00, 0x7F, 0x08, 0x14, 0x22, 0x41 },// K
{ 0x00, 0x7F, 0x40, 0x40, 0x40, 0x40 },// L
{ 0x00, 0x7F, 0x02, 0x0C, 0x02, 0x7F },// M
{ 0x00, 0x7F, 0x04, 0x08, 0x10, 0x7F },// N
{ 0x00, 0x3E, 0x41, 0x41, 0x41, 0x3E },// O
{ 0x00, 0x7F, 0x09, 0x09, 0x09, 0x06 },// P
{ 0x00, 0x3E, 0x41, 0x51, 0x21, 0x5E },// Q
{ 0x00, 0x7F, 0x09, 0x19, 0x29, 0x46 },// R
{ 0x00, 0x46, 0x49, 0x49, 0x49, 0x31 },// S
{ 0x00, 0x01, 0x01, 0x7F, 0x01, 0x01 },// T
{ 0x00, 0x3F, 0x40, 0x40, 0x40, 0x3F },// U
{ 0x00, 0x1F, 0x20, 0x40, 0x20, 0x1F },// V
{ 0x00, 0x3F, 0x40, 0x38, 0x40, 0x3F },// W
{ 0x00, 0x63, 0x14, 0x08, 0x14, 0x63 },// X
{ 0x00, 0x07, 0x08, 0x70, 0x08, 0x07 },// Y
{ 0x00, 0x61, 0x51, 0x49, 0x45, 0x43 },// Z
{ 0x00, 0x00, 0x7F, 0x41, 0x41, 0x00 },// [
{ 0x00, 0x55, 0x2A, 0x55, 0x2A, 0x55 },// 55
{ 0x00, 0x00, 0x41, 0x41, 0x7F, 0x00 },// ]
{ 0x00, 0x04, 0x02, 0x01, 0x02, 0x04 },// ^
{ 0x00, 0x40, 0x40, 0x40, 0x40, 0x40 },// _
{ 0x00, 0x00, 0x01, 0x02, 0x04, 0x00 },// '
{ 0x00, 0x20, 0x54, 0x54, 0x54, 0x78 },// a
{ 0x00, 0x7F, 0x48, 0x44, 0x44, 0x38 },// b
{ 0x00, 0x38, 0x44, 0x44, 0x44, 0x20 },// c
{ 0x00, 0x38, 0x44, 0x44, 0x48, 0x7F },// d
{ 0x00, 0x38, 0x54, 0x54, 0x54, 0x18 },// e
{ 0x00, 0x08, 0x7E, 0x09, 0x01, 0x02 },// f
{ 0x00, 0x18, 0xA4, 0xA4, 0xA4, 0x7C },// g
{ 0x00, 0x7F, 0x08, 0x04, 0x04, 0x78 },// h
{ 0x00, 0x00, 0x44, 0x7D, 0x40, 0x00 },// i
{ 0x00, 0x40, 0x80, 0x84, 0x7D, 0x00 },// j
{ 0x00, 0x7F, 0x10, 0x28, 0x44, 0x00 },// k
{ 0x00, 0x00, 0x41, 0x7F, 0x40, 0x00 },// l
{ 0x00, 0x7C, 0x04, 0x18, 0x04, 0x78 },// m
{ 0x00, 0x7C, 0x08, 0x04, 0x04, 0x78 },// n
{ 0x00, 0x38, 0x44, 0x44, 0x44, 0x38 },// o
{ 0x00, 0xFC, 0x24, 0x24, 0x24, 0x18 },// p
{ 0x00, 0x18, 0x24, 0x24, 0x18, 0xFC },// q
{ 0x00, 0x7C, 0x08, 0x04, 0x04, 0x08 },// r
{ 0x00, 0x48, 0x54, 0x54, 0x54, 0x20 },// s
{ 0x00, 0x04, 0x3F, 0x44, 0x40, 0x20 },// t
{ 0x00, 0x3C, 0x40, 0x40, 0x20, 0x7C },// u
{ 0x00, 0x1C, 0x20, 0x40, 0x20, 0x1C },// v
{ 0x00, 0x3C, 0x40, 0x30, 0x40, 0x3C },// w
{ 0x00, 0x44, 0x28, 0x10, 0x28, 0x44 },// x
{ 0x00, 0x1C, 0xA0, 0xA0, 0xA0, 0x7C },// y
{ 0x00, 0x44, 0x64, 0x54, 0x4C, 0x44 },// z
{ 0x14, 0x14, 0x14, 0x14, 0x14, 0x14 }// horiz lines
};
unsigned char code shuzi[]={
0x7E,0xA1,0x99,0x85,0x7E,0x00,
0x00,0x02,0xFF,0x00,0x00,0x00,
0xC6,0xA1,0x91,0x91,0x8E,0x00,
0x42,0x81,0x89,0x89,0x76,0x00,
0x30,0x2C,0x22,0xFF,0x20,0x00,
0x4F,0x89,0x89,0x89,0x71,0x00,
0x7E,0x89,0x89,0x89,0x72,0x00,
0x01,0x01,0xC1,0x39,0x07,0x00,
0x76,0x89,0x89,0x89,0x76,0x00,
0x4E,0x91,0x91,0x91,0x7E,0x00,
//--
0x08,0x08,0x00,0x08,0x08,0x00,
//:
0x00,0x00,0x66,0x66,0x00,0x00,
//_
0x01,0x01,0x01,0x01,0x01,0x01
};
unsigned char code hanzi[]=
{
/*-- 文字: 我 --*/
/*-- Calibri12; 此字体下对应的点阵为:宽x高=16x16 --*/
0x20,0x24,0x24,0x24,0xFE,0x23,0x22,0x20,0x20,0xFF,0x20,0x22,0x2C,0xA0,0x20,0x00,
0x00,0x08,0x48,0x84,0x7F,0x02,0x41,0x40,0x20,0x13,0x0C,0x14,0x22,0x41,0xF8,0x00,
/*-- 文字: 爱 --*/
/*-- Calibri12; 此字体下对应的点阵为:宽x高=16x16 --*/
0x80,0x64,0x2C,0x34,0x24,0x24,0xEC,0x32,0x22,0x22,0x32,0x2E,0x23,0xA2,0x60,0x00,
0x00,0x41,0x21,0x91,0x89,0x87,0x4D,0x55,0x25,0x25,0x55,0x4D,0x81,0x80,0x80,0x00,
/*-- 文字: 你 --*/
/*-- Calibri12; 此字体下对应的点阵为:宽x高=16x16 --*/
0x00,0x80,0x60,0xF8,0x07,0x40,0x20,0x18,0x0F,0x08,0xC8,0x08,0x08,0x28,0x18,0x00,
0x01,0x00,0x00,0xFF,0x00,0x10,0x0C,0x03,0x40,0x80,0x7F,0x00,0x01,0x06,0x18,0x00,
/*-- 文字: 中 --*/
/*-- Calibri12; 此字体下对应的点阵为:宽x高=16x16 --*/
0x00,0x00,0xF0,0x10,0x10,0x10,0x10,0xFF,0x10,0x10,0x10,0x10,0xF0,0x00,0x00,0x00,
0x00,0x00,0x0F,0x04,0x04,0x04,0x04,0xFF,0x04,0x04,0x04,0x04,0x0F,0x00,0x00,0x00,
/*-- 文字: 国 --*/
/*-- Calibri12; 此字体下对应的点阵为:宽x高=16x16 --*/
0x00,0xFE,0x02,0x12,0x92,0x92,0x92,0xF2,0x92,0x92,0x92,0x12,0x02,0xFE,0x00,0x00,
0x00,0xFF,0x40,0x48,0x48,0x48,0x48,0x4F,0x48,0x4A,0x4C,0x48,0x40,0xFF,0x00,0x00,
/*-- 文字: 大 --*/
/*-- Calibri12; 此字体下对应的点阵为:宽x高=16x16 --*/
0x20,0x20,0x20,0x20,0x20,0x20,0x20,0xFF,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x00,
0x80,0x80,0x40,0x20,0x10,0x0C,0x03,0x00,0x03,0x0C,0x10,0x20,0x40,0x80,0x80,0x00,
/*-- 文字: 学 --*/
/*-- Calibri12; 此字体下对应的点阵为:宽x高=16x16 --*/
0x40,0x30,0x11,0x96,0x90,0x90,0x91,0x96,0x90,0x90,0x98,0x14,0x13,0x50,0x30,0x00,
0x04,0x04,0x04,0x04,0x04,0x44,0x84,0x7E,0x06,0x05,0x04,0x04,0x04,0x04,0x04,0x00,
/*-- 文字: 生 --*/
/*-- Calibri12; 此字体下对应的点阵为:宽x高=16x16 --*/
0x80,0x40,0x30,0x1E,0x10,0x10,0x10,0xFF,0x10,0x10,0x10,0x10,0x10,0x10,0x00,0x00,
0x40,0x40,0x42,0x42,0x42,0x42,0x42,0x7F,0x42,0x42,0x42,0x42,0x42,0x40,0x40,0x00,
};
void delay(uint z)
{
uint x,y;
for(x=z;x>0;x--)
for(y=110;y>0;y--);
}
/*--------------------------------------------
LCD_write_byte: 使用SPI接口写数据到LCD
输入参数:dt:写入的数据;
command :写数据/命令选择;
编写日期:20120918
----------------------------------------------*/
void lcd_write_byte(uchar dat,uchar com)
{
uchar i;
SCE=0;
DC=com;
for(i=0;i<8;i++)
{
if(dat&0x80)
DN=1;
else
DN=0;
dat=dat<<1;
SCLK=0;
SCLK=1;
}
DC=1;
SCE=1;
DN=1;
}
void lcd_init(void)
{
RST=0;
delay(10);
RST=1;
lcd_write_byte(0x21,0); //初始化lcd,功能设定使用扩充指令
lcd_write_byte(0xd0,0); //设定液晶偏置电压
lcd_write_byte(0x20,0); //使用基本指令
lcd_write_byte(0x0c,0); //设定显示模式,正常显示
}
/*-------------------------------------------
LCD_set_XY: 设置LCD坐标函数
输入参数:X:0-83 Y:0-5
编写日期:20080918
---------------------------------------------*/
void lcd_set_XY(unsigned char X, unsigned char Y)
{
lcd_write_byte(0x40 | Y, 0);// column
lcd_write_byte(0x80 | X, 0);// row
}
void lcd_write_my(uchar *font)
{
uchar i;
for(i=0;i<6;i++)
lcd_write_byte(font,1);
}
/*------------------------------------------
LCD_clear: LCD清屏函数
编写日期:20080918
--------------------------------------------*/
void lcd_clear(void)
{
unsigned char t;
unsigned char k;
lcd_set_XY(0,0);
for(t=0;t<6;t++)
{
for(k=0;k<84;k++)
{
lcd_write_byte(0x00,1);
}
}
}
void lcd_write_char(uchar c)
{
uchar i;
c-=32;
for(i=0;i<6;i++)
lcd_write_byte(font6x8[c],1);
}
void lcd_write_string(uchar X,uchar Y,char *s)
{
lcd_set_XY(X,Y);
while(*s)
{
lcd_write_char(*s);
s++;
}
}
void LCD_write_shu(unsigned char row, unsigned char page,unsigned char c) //row:列 page:页 dd:字符
{
unsigned char i;
lcd_set_XY(row*6, page);// 列,页
for(i=0; i<6;i++)
{
lcd_write_byte(shuzi[c*6+i],1);
}
}
/*---------------------------------------------
LCD_write_hanzi: 显示16(宽)*16(高)点阵列汉字等半角类
输入参数:c:显示的字符;
编写日期:20080918
-----------------------------------------------*/
void lcd_write_hanzi(unsigned char row, unsigned char page,unsigned char c) //row:列 page:页 dd:字符
{
unsigned char i;
lcd_set_XY(row*8, page);// 列,页
for(i=0; i<16;i++)
{
lcd_write_byte(hanzi[c*32+i],1);
}
lcd_set_XY(row*8, page+1);// 列,页
for(i=16; i<32;i++)
{
lcd_write_byte(hanzi[c*32+i],1);
}
}
void Write_Cmd(uchar com)
{
lcd_write_byte(com,0);
}
void Write_Dat(uchar dat)
{
lcd_write_byte(dat,1);
}
/***********************************************************
函数名称:Write_FullPic
函数功能:写整屏的图片
出口参数:无
备 注:要求图片大小:宽84,高48
***********************************************************/
void Write_FullPic(uchar *c)
{
uint i,j;
//Lcd_Set_XY(0,0);
for(i=0;i<6;i++)
{
lcd_set_XY(0,i);
for(j=0;j<84;j++)
{ Write_Dat(c[i*84+j]);}
}
}
/***********************************************************
函数名称:Write_4040Pic
函数功能:写整屏的图片
出口参数:X,必须保证X之后有40个像素点
备 注:要求图片大小:宽40,高40
***********************************************************/
void Write_4040Pic(uchar X,uchar *c)
{
//
int i,j;
for(i=0;i<6;i++)
{
lcd_set_XY(X,i);
for(j=0;j<48;j++)
{ Write_Dat(c[i*48+j]);}
}
}
/*----------------------------------------
18b20温度传感器
------------------------------------*/
/******************************ds1820程序***************************************/
void delay_18B20(unsigned int i)//延时1微秒
{
while(i--);
}
void ds1820rst()/*ds1820复位*/
{
DQ = 1; //DQ复位
delay_18B20(4); //延时
DQ = 0; //DQ拉低
delay_18B20(100); //精确延时大于480us
DQ = 1;//拉高
delay_18B20(40);
}
uchar ds1820rd()/*读数据*/
{
unsigned char i=0;
unsigned char dat = 0;
for (i=8;i>0;i--)
{
DQ = 0; //给脉冲信号
dat>>=1;
DQ = 1; //给脉冲信号
if(DQ)
dat|=0x80;
delay_18B20(10);
}
return(dat);
}
void ds1820wr(uchar wdata)/*写数据*/
{
unsigned char i=0;
for (i=8; i>0; i--)
{
DQ = 0;
DQ = wdata&0x01;
delay_18B20(10);
DQ = 1;
wdata>>=1;
}
}
read_temp()/*读取温度值并转换*/
{
uchar a,b;
ds1820rst();
ds1820wr(0xcc);//*跳过读序列号*/
ds1820wr(0x44);//*启动温度转换*/
ds1820rst();
ds1820wr(0xcc);//*跳过读序列号*/
ds1820wr(0xbe);//*读取温度*/
a=ds1820rd();
b=ds1820rd();
tvalue=b;
tvalue<<=8; //tvalue是16位的,这条指令是将8位的b送给tvalue的高八位 右移八位
tvalue=tvalue|a; //a给tvalue低八位
if(tvalue<0x0fff)
tflag=0;
else
{
tvalue=~tvalue+1;
tflag=1;
}
tvalue=tvalue*(0.625);//温度值扩大10倍,精确到1位小数
return(tvalue);
}
/*******************************************************************/
void ds1820disp()//温度值显示
{
uchar flagdat;
disdata[0]=tvalue/1000+0x30;//百位数
disdata[1]=tvalue%1000/100+0x30;//十位数
disdata[2]=tvalue%100/10+0x30;//个位数
disdata[3]=tvalue%10+0x30;//小数位/**/
if(tflag==0)
{
flagdat=0x20;//正温度不显示符号
lcd_write_string(0,5,"+");
}
else
{
flagdat=0x2d;//负温度显示负号:-
lcd_write_string(0,5,"-");
}
if(disdata[0]==0x30)
{
disdata[0]=0x20;//如果百位为0,不显示
if(disdata[1]==0x30)
{
disdata[1]=0x20;//如果百位为0,十位为0也不显示
}
}
LCD_write_shu(1,5,tvalue/1000);
LCD_write_shu(2,5,tvalue%1000/100);
LCD_write_shu(3,5,tvalue%100/10);
lcd_set_XY(25,5);
lcd_write_my(A);
LCD_write_shu(5,5,tvalue%10);
lcd_set_XY(37,5);
lcd_write_my(A1);
}
void main()
{
lcd_init();
LED=1;
lcd_clear();
Write_4040Pic(1,tu2);
while(1)
{
read_temp();
if(K1==0)
{
delay(10);
if(K1==0)
{
while(!K1);
// flag=1;
lcd_clear();
Write_FullPic(tu);
}
}
if(K2==0)
{ delay(10);
if(K2==0)
{
while(!K3);
// flag=1;
lcd_clear();
Write_4040Pic(1,tu1);
}
}
if(K3==0)
{
delay(10);
if(K3==0)
{
while(!K3);
lcd_clear();
flag=0;
while(flag==0)
{
if(K2==0|K1==0)
flag=1;
read_temp();
lcd_write_hanzi(0,0,0); //我
lcd_write_hanzi(2,0,1); //爱
lcd_write_hanzi(4,0,2); //你
lcd_write_hanzi(6,0,3); //中
lcd_write_hanzi(8,0,4); //国
lcd_write_hanzi(1,2,5); //大
lcd_write_hanzi(4,2,6); //学
lcd_write_hanzi(7,2,7); //生
ds1820disp();//显示
}
}
}
}
}
谢谢了
牛人啊
附上图片就更好了
学习中
good 。8888
谢谢分享啊。这个数组找了好久。
没图没真相
图片没有看到啊
学习了。
我在网上看到一段程序,其中初始化部分如下:
/***********************************************************
函数名称:LCD_init
函数功能:5110初始化
入口参数:无
出口参数:无
备 注:
***********************************************************/
void LCD_init(void)
{
LCD_RST = 0; // 产生一个让LCD复位的低电平脉冲
delay_1us();
LCD_RST = 1;
LCD_CE = 0; // 关闭LCD?低电平LCD才有效
delay_1us();
LCD_CE = 1; // 使能LCD
delay_1us();
LCD_write_byte(0x21, 0); // 使用扩展命令设置LCD模式
LCD_write_byte(0xc8, 0); // 设置液晶偏置电压
LCD_write_byte(0x06, 0); // 温度校正
LCD_write_byte(0x13, 0); // 1:48
LCD_write_byte(0x20, 0); // 使用基本命令,V=0,水平寻址
LCD_clear(); // 清屏
LCD_write_byte(0x0c, 0); // 设定显示模式,正常显示
LCD_CE = 0; // 关闭LCD
}
有个疑问,
LCD_CE = 0不是应该使LCD有效吗?
......
找到这个数组啦,谢啦
求小编爆实际测试图啊
假的 我编译了 好多错误
谢谢了,最近在看5110怎么用