红外线解码 VS1838B接头 12864液晶 51单片机 合众之星万能遥控器

长平狐 发布于 2012/10/08 15:24
阅读 657
收藏 1

MySQL连接为什么挂死了?别踩坑!>>>

注:我的液晶是带字库的液晶,红外线接头为VS1838B一体化接头,合众之星万能遥控器

#include<reg52.h>
#define uint  unsigned int
#define uchar unsigned char
#define x1    0x80
#define x2    0x88
#define y     0x80
#define comm  0
#define dat   1
sbit RS = P2^2;   //H=data; L="command";
sbit RW = P2^3;   //H=read; L="write";
sbit E = P2^4;   //input enable;
sbit PSB= P2^5;   //H=并口; L="串口";
sbit busy=P0^7;   //lcd busy bit
void wr_lcd(uchar dat_comm,uchar content);
void chk_busy (void);
uchar a[4]={0,0,0,0},j,i,k,num=0;      //定义变量
sbit js=P3^2;   //红外接收端
uchar code tab[]={
/*128*64  我的取模软件中,图像的取模设置是:横向取模,字节不倒序*/
/*--  调入了一幅图像:C:/Documents and Settings/zhb/桌面/未标题2副本.bmp  --*/
/*--  宽度x高度=128x64  --*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x07,0x04,0x00,0x00,0x1C,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x30,
0x00,0x1F,0x0F,0x80,0x00,0x1E,0x00,0x00,0x00,0x30,0x00,0x78,0x00,0x00,0x00,0x70,
0x00,0x7F,0x87,0xC0,0x00,0x0E,0x00,0x0C,0x00,0x30,0x00,0x70,0x00,0x60,0x06,0x36,
0x00,0xF3,0x83,0xE0,0x00,0x1E,0x00,0x06,0x00,0x7C,0x00,0x26,0x00,0x60,0x02,0x3E,
0x01,0xE3,0x81,0xF0,0x00,0x3F,0xE0,0x06,0x00,0xFE,0x00,0x3E,0x00,0x68,0x03,0xFE,
0x01,0xC3,0x83,0xF0,0x00,0x3F,0x60,0x04,0x00,0x7F,0x80,0x7C,0x00,0xC8,0x07,0xFC,
0x03,0xC1,0xFF,0xF0,0x00,0x1F,0xE0,0x1C,0x00,0xFF,0x82,0xF0,0x00,0xF0,0x07,0xF8,
0x03,0xC7,0xFE,0xF0,0x00,0x3F,0x60,0x3C,0x01,0xFF,0x87,0xFC,0x00,0xF0,0x07,0xF8,
0x07,0xDF,0xE0,0xF0,0x00,0x7F,0x60,0x1E,0x03,0xFF,0x07,0xFC,0x01,0xE0,0x07,0xF0,
0x03,0xFF,0xE0,0xE0,0x00,0xFF,0x60,0x1E,0x07,0xFF,0x0E,0xF8,0x07,0xE0,0x07,0xF8,
0x07,0xF8,0xE1,0xC0,0x01,0x87,0x60,0x1C,0x1D,0xFE,0x0C,0x78,0x1F,0xC0,0x03,0x70,
0x1F,0xE0,0xE3,0xC0,0x00,0x0F,0xE0,0x1E,0x0B,0x7E,0x80,0xF8,0x0B,0x80,0x06,0xE0,
0x3F,0xE0,0xF7,0x80,0x02,0x03,0xE0,0x5F,0x02,0xF6,0xC1,0xF0,0x03,0x80,0x1C,0x70,
0x3D,0xF8,0x7E,0x00,0x07,0x06,0x61,0xDF,0x80,0xE7,0x81,0xE0,0x03,0xF8,0x39,0xF0,
0x00,0x78,0x7C,0x00,0x07,0x06,0x07,0x3E,0x00,0x07,0x80,0xCC,0x06,0x18,0x33,0xF0,
0x00,0x00,0x70,0x00,0x07,0x06,0x06,0x00,0x00,0x04,0x00,0x78,0x00,0x00,0x07,0xE0,
0x00,0x00,0x78,0x00,0x02,0x04,0x00,0x00,0x00,0x04,0x00,0x70,0x00,0x00,0x00,0x00,
0x00,0x00,0x38,0x00,0x00,0x00,0x00,0x00,0x00,0x06,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x1F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xF8,0x00,
0x00,0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x0C,0x06,0x00,0x00,0x00,0x00,0x17,0x00,
0x03,0x00,0xC0,0x00,0x41,0xE0,0x00,0x60,0x1F,0x00,0x07,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x07,0xF8,0x00,0x00,0x7F,0xFF,0x7F,0x3F,0xFF,0xFE,
0x3E,0x02,0x03,0xF0,0x3F,0x00,0x03,0xF0,0x00,0x00,0x3F,0xFC,0x3E,0x1F,0x3F,0xF0,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
};
uchar code tab1[]={
/*--  调入了一幅图像:C:/Documents and Settings/zhb/桌面/未标题-1.bmp  --*/
/*--  宽度x高度=128x64  --*/
0x00,0x00,0x00,0x00,0x00,0x38,0x38,0x18,0x00,0x3F,0xFF,0x80,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x10,0x38,0x38,0x00,0x31,0xC7,0x80,0x03,0x04,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x18,0x30,0x18,0x00,0x31,0xC7,0x80,0x03,0x87,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x18,0x10,0x18,0x00,0x31,0xC3,0x80,0x01,0xCE,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x10,0x10,0x38,0x00,0x30,0xC3,0x80,0x0F,0xFF,0xC0,0x00,
0x00,0x00,0x00,0x00,0x00,0x38,0x10,0x38,0x00,0x30,0xC3,0x80,0x0F,0xFF,0xC0,0x00,
0x00,0x00,0x00,0x00,0x00,0x38,0x10,0x00,0x00,0x30,0xC3,0x80,0x0F,0xB7,0xC0,0x00,
0x00,0x00,0x60,0x00,0x00,0x10,0x10,0x00,0x00,0x38,0xC3,0x80,0x0D,0xBE,0xC0,0x00,
0x00,0x07,0xFC,0x00,0x00,0x18,0x10,0x00,0x00,0x38,0xC3,0x80,0x0D,0xBC,0xC0,0x00,
0x00,0x3F,0xF7,0x00,0x00,0x18,0x38,0x00,0x00,0x38,0xC3,0x80,0x0F,0xFF,0xC0,0x00,
0x01,0xFE,0x73,0x80,0x00,0x10,0x38,0x00,0x00,0x30,0xC7,0x80,0x0C,0x02,0xC0,0x00,
0x01,0x1C,0x73,0x80,0x00,0x18,0x38,0x0F,0xFE,0x31,0xE7,0x80,0x03,0xFF,0x00,0x00,
0x00,0x1C,0x71,0x80,0x00,0x10,0x38,0x7F,0xFF,0xC1,0xC3,0x80,0x03,0x03,0x00,0x00,
0x00,0x1C,0x70,0xE0,0x00,0x10,0x11,0xFB,0xFF,0xF0,0xC3,0x80,0x03,0x03,0x00,0x00,
0x03,0xFF,0xFF,0xF0,0x00,0x18,0x03,0x82,0x0F,0xF8,0xC3,0x80,0x03,0xFF,0x00,0x00,
0x03,0xFF,0xFF,0xF0,0x00,0x18,0x06,0x02,0x03,0xFE,0xC3,0x80,0x03,0x03,0x00,0x00,
0x00,0x1C,0x31,0x80,0x00,0x10,0x08,0x33,0x71,0xFF,0x03,0x80,0x03,0xFF,0x00,0x00,
0x00,0x1C,0x33,0xC0,0x00,0x18,0x00,0x3F,0xF0,0x7F,0x83,0x80,0x03,0x03,0x00,0x00,
0x00,0x1F,0xF3,0x80,0x00,0x38,0x00,0x7F,0xF0,0x3F,0xC3,0x80,0x02,0x02,0x00,0x00,
0x00,0x1F,0xB7,0x00,0x00,0x10,0x00,0x3F,0xE0,0x3F,0xC3,0x80,0x00,0x00,0x00,0x00,
0x01,0xFE,0x3F,0x00,0x00,0x18,0x00,0x02,0x00,0x1F,0xE7,0x80,0x00,0x00,0x00,0x00,
0x03,0xFC,0x3E,0x00,0x00,0x18,0x00,0x02,0x00,0x1F,0xE7,0x80,0x00,0x00,0x00,0x00,
0x03,0xDC,0x3C,0x30,0x00,0x18,0x00,0x3E,0xF0,0x0F,0xF3,0x80,0x03,0x18,0x00,0x00,
0x01,0x1C,0x7C,0x30,0x00,0x39,0x00,0x7F,0xF8,0x0F,0xF3,0x80,0x07,0x3C,0x00,0x00,
0x00,0x1C,0xFE,0x30,0x00,0x19,0x00,0xFF,0xFC,0x0F,0xFB,0x80,0x06,0x73,0x00,0x00,
0x00,0x1F,0xEF,0x30,0x00,0x3B,0x00,0xFF,0xFC,0x07,0xFB,0x80,0x06,0xE1,0xC0,0x00,
0x00,0xFF,0x87,0xF0,0x00,0x3B,0x00,0xFF,0xFC,0x07,0xFB,0x80,0x0E,0xFF,0xC0,0x00,
0x00,0xFE,0x03,0xF0,0x00,0x3B,0x00,0x7F,0xF8,0x07,0xFB,0x80,0x0E,0xF7,0xC0,0x00,
0x00,0x38,0x00,0xF8,0x00,0x03,0x00,0x7F,0xF0,0x07,0xFB,0x80,0x1E,0xF3,0xC0,0x00,
0x00,0x30,0x00,0x00,0x00,0x03,0x00,0x3F,0xE0,0x07,0xFF,0x80,0x1C,0xF9,0xC0,0x00,
0x00,0x00,0x00,0x00,0x00,0x03,0x00,0x1F,0xC0,0x0F,0xFF,0x80,0x3F,0xBB,0xC0,0x00,
0x00,0x00,0x07,0xC0,0x00,0x03,0x00,0x0F,0x80,0x0F,0xFF,0x80,0x2F,0x7F,0x80,0x00,
0x00,0x01,0xFF,0xE0,0x00,0x03,0x80,0x03,0x00,0x0F,0xFB,0x80,0x0C,0xF7,0x00,0x00,
0x00,0xFF,0xFF,0x00,0x00,0x03,0x80,0x00,0x00,0x1F,0xFB,0x80,0x0D,0xF6,0x00,0x00,
0x00,0x39,0xC7,0x80,0x00,0x03,0xC0,0x00,0x00,0x1F,0xFB,0x80,0x0F,0x9E,0x00,0x00,
0x00,0x1C,0xE7,0x00,0x00,0x01,0xE0,0x00,0x00,0x3F,0xFB,0x80,0x0F,0x1C,0x00,0x00,
0x00,0x1C,0xEE,0x00,0x00,0x01,0xF0,0x00,0x00,0x7F,0xF3,0x80,0x0C,0x3F,0x00,0x00,
0x00,0xCC,0x6C,0x60,0x00,0x01,0xF8,0x00,0x00,0xFF,0xF3,0x80,0x0C,0xF7,0xE0,0x00,
0x00,0xFF,0xFF,0xF0,0x00,0x00,0xFC,0x00,0x01,0xFF,0xE3,0x80,0x0F,0xC1,0xE0,0x00,
0x01,0xC3,0x00,0xF0,0x00,0x00,0xFF,0x00,0x07,0xFF,0xE7,0x80,0x00,0x00,0x00,0x00,
0x01,0x83,0x80,0xC0,0x00,0x00,0x7F,0xC3,0x1F,0xFF,0xC7,0x80,0x00,0x00,0x00,0x00,
0x03,0x83,0x03,0x80,0x00,0x00,0x3F,0xFF,0xFF,0xFF,0x87,0x80,0x00,0x00,0x00,0x00,
0x00,0xFF,0xFF,0xC0,0x00,0x00,0x1F,0xFF,0xFF,0xFF,0x83,0x80,0x00,0x00,0x00,0x00,
0x00,0x47,0x02,0x00,0x00,0x60,0x0F,0xFF,0xFF,0xFF,0x03,0x80,0x00,0x07,0x00,0x00,
0x00,0x07,0xFF,0x00,0x00,0x7C,0x07,0xFF,0xFF,0xFE,0x00,0x80,0x01,0xC6,0x60,0x00,
0x00,0x0F,0xFF,0x00,0x00,0x7E,0x03,0xFF,0xFF,0xF8,0x00,0x80,0x1F,0xFF,0xE0,0x00,
0x00,0x0F,0x8E,0x00,0x00,0x7F,0x80,0xFF,0xFF,0xF0,0x00,0x80,0x02,0x07,0x00,0x00,
0x00,0x1D,0xDE,0x00,0x00,0x7F,0xC0,0x3F,0xFF,0xC0,0x00,0x80,0x02,0x0F,0x80,0x00,
0x00,0x38,0xFC,0x00,0x00,0x7F,0xC0,0x07,0xFE,0x00,0x00,0x80,0x02,0x1D,0xC0,0x00,
0x00,0x78,0xF8,0x00,0x00,0x7F,0xE0,0x3F,0x80,0x00,0x00,0x80,0x03,0xB8,0xF0,0x00,
0x00,0xF1,0xFF,0xC0,0x00,0x7F,0xE0,0xFF,0xC0,0x00,0x00,0x80,0x1F,0xFF,0xF0,0x00,
0x01,0xCF,0xCF,0xF0,0x00,0x7F,0xF9,0xFF,0xE0,0x00,0x00,0x80,0x02,0x33,0xC0,0x00,
0x01,0xFE,0x03,0xF0,0x00,0x7F,0xFF,0xFF,0xF0,0x00,0x00,0x80,0x02,0x3F,0xC0,0x00,
0x00,0x60,0x00,0x00,0x00,0x7F,0xFF,0xFF,0xF8,0x00,0x00,0x80,0x02,0x36,0xC0,0x00,
0x00,0x00,0x00,0x00,0x00,0x7F,0xFF,0xFF,0xF8,0x00,0x00,0x80,0x02,0xF6,0xC0,0x00,
0x00,0x00,0x00,0x00,0x00,0x7F,0xFF,0xFF,0xFF,0x00,0x00,0x80,0x1F,0xFE,0xC0,0x00,
0x00,0x00,0x00,0x00,0x00,0x7F,0xFF,0xFF,0xFF,0xC0,0x00,0x80,0x1E,0x36,0xC0,0x00,
0x00,0x00,0x00,0x00,0x00,0x7F,0xFF,0xFF,0xFF,0xE0,0x00,0x80,0x18,0x36,0xC0,0x00,
0x00,0x00,0x00,0x00,0x00,0x7F,0xFF,0xFF,0xFF,0xF0,0x00,0x80,0x00,0x07,0xC0,0x00,
0x00,0x00,0x00,0x00,0x00,0x7F,0xFF,0xFF,0xFF,0xFF,0x00,0x80,0x00,0x01,0xC0,0x00,
0x00,0x00,0x00,0x00,0x00,0x7F,0xFF,0xFF,0xFF,0xFF,0xDF,0x80,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x7F,0xFF,0xFF,0xFF,0xFF,0xFF,0x80,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x7F,0xFF,0xFF,0xFF,0xFF,0xFF,0x80,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x7F,0xFF,0xFF,0xFF,0xFF,0xFF,0x80,0x00,0x00,0x00,0x00
};
uchar code tab2[]={
/*--  调入了一幅图像:C:/Documents and Settings/zhb/桌面/2.bmp  --*/
/*--  宽度x高度=128x64  --*/
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xF0,0x60,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0xF1,0xF0,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0xF9,0xF8,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0xFB,0xF8,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0xFB,0xF8,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0xFB,0xF8,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0xFB,0xF8,
0x00,0x00,0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3D,0xFB,0xF0,
0x00,0x07,0xFC,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3E,0xFB,0xF7,
0x00,0x3F,0xF7,0x00,0x00,0x00,0x7F,0xC0,0x00,0x7F,0x80,0x00,0x00,0x7F,0x71,0xEF,
0x01,0xFE,0x73,0x80,0x00,0x01,0x80,0x20,0x01,0x80,0x60,0x00,0x00,0x7F,0x00,0x1F,
0x01,0x1C,0x73,0x80,0x00,0x02,0x00,0x10,0x02,0x00,0x18,0x00,0x00,0x7F,0x00,0x1F,
0x00,0x1C,0x71,0x80,0x00,0x04,0x00,0x0C,0x04,0x00,0x04,0x00,0x00,0x3F,0x1E,0x3F,
0x00,0x1C,0x70,0xE0,0x00,0x04,0x00,0x02,0x08,0x00,0x04,0x00,0x00,0x3F,0x7F,0xBF,
0x03,0xFF,0xFF,0xF0,0x00,0x09,0xFF,0x01,0x09,0xFE,0x02,0x00,0x01,0xDF,0xFF,0xFF,
0x03,0xFF,0xFF,0xF0,0x00,0x16,0x00,0x80,0x96,0x01,0x81,0x00,0x0F,0x06,0xFF,0xFF,
0x00,0x1C,0x31,0x80,0x00,0x18,0x00,0x40,0xA8,0x00,0x61,0x00,0x7C,0x01,0xFF,0xFE,
0x00,0x1C,0x33,0xC0,0x00,0x30,0x00,0x30,0x70,0x00,0x10,0x81,0xF0,0x03,0xFF,0xF0,
0x00,0x1F,0xF3,0x80,0x00,0x30,0x00,0x08,0x60,0x00,0x10,0x8F,0xC0,0x03,0xFF,0xF0,
0x00,0x1F,0xB7,0x00,0x00,0x20,0x00,0x04,0x20,0x00,0x08,0x7F,0x00,0x07,0xFF,0xF8,
0x01,0xFE,0x3F,0x00,0x00,0x40,0x00,0x02,0x40,0x00,0x07,0xF8,0x00,0x07,0xFF,0xF8,
0x03,0xFC,0x3E,0x00,0x00,0x40,0x00,0x02,0x80,0x00,0x0F,0xE0,0x00,0x07,0xFF,0xF8,
0x03,0xDC,0x3C,0x30,0x00,0xC0,0x00,0x01,0x80,0x00,0x07,0xC0,0x03,0x1F,0xFF,0xF8,
0x01,0x1C,0x7C,0x30,0x00,0xC0,0x00,0x01,0x00,0x00,0x02,0x40,0x07,0x3F,0xF1,0xE0,
0x00,0x1C,0xFE,0x30,0x00,0xC0,0x00,0x00,0x00,0x00,0x01,0x40,0x06,0x73,0x00,0x00,
0x00,0x1F,0xEF,0x30,0x01,0x40,0x00,0x00,0x00,0x00,0x01,0x40,0x06,0xE1,0xC0,0x00,
0x00,0xFF,0x87,0xF0,0x01,0x40,0x00,0x00,0x00,0x00,0x01,0x40,0x0E,0xFF,0xC0,0x00,
0x00,0xFE,0x03,0xF0,0x01,0x40,0x00,0x00,0x00,0x00,0x01,0x40,0x0E,0xF7,0xC0,0x00,
0x00,0x38,0x00,0xF8,0x01,0x40,0x00,0x00,0x00,0x00,0x01,0x40,0x1E,0xF3,0xC0,0x00,
0x00,0x30,0x00,0x00,0x01,0x40,0x00,0x00,0x00,0x00,0x01,0x40,0x1C,0xF9,0xC0,0x00,
0x00,0x00,0x00,0x00,0x01,0x20,0x00,0x00,0xE0,0x00,0x01,0x80,0x3F,0xBB,0xC0,0x00,
0x00,0x00,0x07,0xC0,0x01,0x20,0x00,0x07,0xC0,0x00,0x01,0x80,0x2F,0x7F,0x80,0x00,
0x00,0x01,0xFF,0xE0,0x01,0x10,0x00,0x1E,0x00,0x00,0x01,0x00,0x0C,0xF7,0x00,0x00,
0x00,0xFF,0xFF,0x00,0x01,0x10,0x00,0xF8,0x00,0x00,0x01,0x00,0x0D,0xF6,0x00,0x00,
0x00,0x39,0xC7,0x80,0x01,0x08,0x03,0xC0,0x00,0x00,0x03,0x00,0x0F,0x9E,0x00,0x00,
0x00,0x1C,0xE7,0x00,0x00,0x84,0x1F,0x00,0x00,0x00,0x06,0x00,0x0F,0x1C,0x00,0x00,
0x00,0x1C,0xEE,0x00,0x00,0x82,0x78,0x00,0x00,0x00,0x0A,0x00,0x0C,0x3F,0x00,0x00,
0x00,0xCC,0x6C,0x60,0x00,0x43,0xE0,0x00,0x00,0x00,0x14,0x00,0x0C,0xF7,0xE0,0x00,
0x00,0xFF,0xFF,0xF0,0x00,0x4F,0x80,0x00,0x00,0x00,0x24,0x00,0x0F,0xC1,0xE0,0x00,
0x01,0xC3,0x00,0xF0,0x00,0x3C,0x60,0x00,0x00,0x00,0xC8,0x00,0x00,0x00,0x00,0x00,
0x01,0x83,0x80,0xC0,0x01,0xF0,0x10,0x00,0x00,0x03,0x10,0x00,0x00,0x00,0x00,0x00,
0x03,0x83,0x03,0x80,0x07,0x88,0x0C,0x00,0x00,0x04,0x20,0x00,0x00,0x00,0x00,0x00,
0x00,0xFF,0xFF,0xC0,0x3E,0x04,0x02,0x00,0x00,0x08,0x40,0x00,0x00,0x00,0x00,0x00,
0x00,0x47,0x02,0x00,0xF0,0x02,0x01,0x00,0x00,0x10,0x80,0x00,0x00,0x07,0x00,0x00,
0x00,0x07,0xFF,0x07,0xC0,0x01,0x80,0xC0,0x00,0x23,0x00,0x00,0x01,0xC6,0x60,0x00,
0x00,0x0F,0xFF,0x1E,0x00,0x00,0x40,0x20,0x00,0x4C,0x00,0x00,0x1F,0xFF,0xE0,0x00,
0x00,0x0F,0x8E,0x78,0x00,0x00,0x30,0x10,0x01,0x90,0x00,0x00,0x02,0x07,0x00,0x00,
0x00,0x1D,0xDE,0x40,0x00,0x00,0x08,0x08,0x02,0x20,0x00,0x00,0x02,0x0F,0x80,0x00,
0x00,0x38,0xFC,0x00,0x00,0x00,0x04,0x04,0x04,0x40,0x00,0x00,0x02,0x1D,0xC0,0x00,
0x00,0x78,0xF8,0x00,0x00,0x00,0x03,0x02,0x08,0x80,0x00,0x00,0x03,0xB8,0xF0,0x00,
0x00,0xF1,0xFF,0xC0,0x00,0x00,0x00,0x81,0x09,0x00,0x00,0x00,0x1F,0xFF,0xF0,0x00,
0x01,0xCF,0xCF,0xF0,0x00,0x00,0x00,0x41,0x16,0x00,0x00,0x00,0x02,0x33,0xC0,0x00,
0x01,0xFE,0x03,0xF0,0x00,0x00,0x00,0x20,0x98,0x00,0x00,0x00,0x02,0x3F,0xC0,0x00,
0x00,0x60,0x00,0x00,0x00,0x00,0x00,0x10,0xB0,0x00,0x00,0x00,0x02,0x36,0xC0,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x08,0x60,0x00,0x00,0x00,0x02,0xF6,0xC0,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x20,0x00,0x00,0x00,0x1F,0xFE,0xC0,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x04,0x40,0x00,0x00,0x00,0x1E,0x36,0xC0,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x40,0x00,0x00,0x00,0x18,0x36,0xC0,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x80,0x00,0x00,0x00,0x00,0x07,0xC0,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x01,0xC0,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,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 init_lcd (void)
{
 PSB = 1;
 wr_lcd(comm,0x30);  /*30---基本指令动作*/
 wr_lcd(comm,0x01);  /*清屏,地址指针指向00H*/
 wr_lcd(comm,0x06);  /*光标的移动方向*/
 wr_lcd(comm,0x0c);  /*开显示,关游标*/
}
void wr_lcd(uchar dat_comm,uchar content)
{
 chk_busy ();
 if(dat_comm)
    {
  RS = 1;   //data
  RW = 0;   //write
    }
 else
    {
  RS = 0;   //command
  RW = 0;   //write
    }
 P0=content;   //output data or comm
 E = 1;
 ;
 E = 0;
}
void chk_busy(void)
{
 P0 = 0xff;
 RS = 0;
 RW = 1;
 E = 1;
 while(busy==1);
 E = 0;
}
void delay(uint us)   //delay time
{
 while(us--);
}
void delay1(uint ms)
{
   uint i,j;
   for(i=0;i<ms;i++)
   for(j=0;j<15;j++)
   delay(1);
}
void img_disp(uchar code *img)
{
   uchar i,j;
   for(j=0;j<32;j++)
   {
     for(i=0;i<8;i++)
     {
       wr_lcd(comm,0x34);
       wr_lcd(comm,y+j);
       wr_lcd(comm,x1+i);
       wr_lcd(comm,0x30);
       wr_lcd(dat,img[j*16+i*2]);
       wr_lcd(dat,img[j*16+i*2+1]);
     }
   }
   for(j=32;j<64;j++)
   {
     for(i=0;i<8;i++)
     {
       wr_lcd(comm,0x34);
       wr_lcd(comm,y+j-32);
       wr_lcd(comm,x2+i);
       wr_lcd(comm,0x30);
       wr_lcd(dat,img[j*16+i*2]);
       wr_lcd(dat,img[j*16+i*2+1]);
     }
   }
   wr_lcd (comm,0x36);
}
void lat_disp(uchar data1,uchar data2)
{
 uchar i,j,k,x;
 x=x1;
 for(k=0;k<2;k++)
 {
  for(j=0;j<16;j++)
  {
   for(i=0;i<8;i++)
   {
    wr_lcd(comm,0x34);
    wr_lcd(comm,y+j*2);
    wr_lcd(comm,x+i);
    wr_lcd(comm,0x30);
    wr_lcd(dat,data1);
    wr_lcd(dat,data1);
   }
   for(i=0;i<8;i++)
   {
    wr_lcd(comm,0x34);
    wr_lcd(comm,y+j*2+1);
    wr_lcd(comm,x+i);
    wr_lcd(comm,0x30);
    wr_lcd(dat,data2);
    wr_lcd(dat,data2);
   }
  }
  x=x2;
 }
 wr_lcd(comm,0x36);
}

void main()
{
 EA=1;    //初始化
 ET0=1;  //开计数中断0
 EX0=1;   //开外部中断0
 TMOD=1; //设置工作方式
 IT0=1;    //启动计时器
 init_lcd();
 lat_disp(0x00,0x00);//使屏幕预先显示空白
    img_disp(tab);
    delay1(4000);
 while(1)
 {
  if((a[2]+a[3])==0xff)  //判断接收到数据是否正确
  {
  switch(a[2])   //将接受到的数据与所建表一一对应
  { 
            case 0x00:
   {
       num=0;break;//数字键0
   }
            case 0x01:
   {
       num=1;break;//数字键1
   }
            case 0x02:
   {
       num=2;break;//数字键2
   }
            case 0x03:
   {
       num=3;break;//数字键3
   }
            case 0x04:
   {
       num=4;break;//数字键4
   }
            case 0x05:
   {
       num=5;break;//数字键5
   }
   case 0x06:
   {
       num=6;break;//数字键6
   }
   case 0x07:
   {
       num=7;break;//数字键7
   }
   case 0x08:
   {
       num=8;break;//数字键8
   }
   case 0x09:
   {
       num=9;break;//数字键9
   }
   case 0x0a:
   {
       num=10;break;//键"--/-"
   }
   case 0x0b:
   {
        num=11;break;//键LG
   }
   case 0x0f:
   {
         num=12; break;//AV键
   }
   case 0x10:
   {
       num=13;break;//静音键
   }
   case 0x15:
   {
       num=14;break;//开关键
   }
   case 0x16:
   {
       num=15;break;//选台键
   }
   case 0x17:
   {
       num=16;break;//睡眠键
   }
   case 0x1a:
   {
        num=17;break;//音量+
   }
   case 0x1b:
   {
       num=18;break;//频道+
   }
   case 0x1c:
   {
       num=19;break;//屏显
   }
   case 0x1e:
   {
       num=20;break;//音量-
   }
   case 0x1f:
   {
       num=21;break;//频道-
   }
   case 0x30:
   {
       num=22;break;//小键'-'
    }
   case 0x4e:
   {
        num=23;break;//小键'+'
   }
   case 0x51:
   {
        num=24;break;//画中画
   }
   case 0x56:
   {
        num=25;break;//图像,菜单
   }
   case 0x57:
   {
        num=26;break;//声音
   }
   case 0x5a:
   {
       lat_disp(0x00,0x00);//使屏幕预先显示空白
                img_disp(tab1);
    delay1(2000);
        num=27;break;//方向上
   }
   case 0x5b:
   {
       lat_disp(0x00,0x00);//使屏幕预先显示空白
                img_disp(tab1);
    delay1(2000);
        num=28;break;//方向右
   }
   case 0x5c:
   {
        num=29;break;//完成
   }
   case 0x5e:
   {
       lat_disp(0x00,0x00);//使屏幕预先显示空白
                img_disp(tab2);
    delay1(2000);
        num=30;break;//方向下
   }
   case 0x5f:
   {  
       lat_disp(0x00,0x00);//使屏幕预先显示空白
                img_disp(tab2);
    delay1(2000);
        num=31;break;//方向左
   }
            default:break;
  }
  }
/*  if(num!=0)
  {
     
  }
  num=0;
  */
 }
}
void zhb(void) interrupt 0 // 外部中断子程序(译码过程)
{
 TH0=0;   //计数器清零
 TL0=0;
 TR0=1;   //启动计数器
 while(!js)   //等待低电平结束
 {
  delay(5);
  if(TH0>45)  //判断低电平是否高于11.52ms如果高于则跳出等待和中断
   return;
 }
 TR0=0;
 if(TH0<30)  //判断低电平是否低于7.68ms如果低于跳出中断
  return;
 TH0=0;
 TR0=1;
 while(js)   //等待高电平结束
 {
  delay(5);
  if(TH0>28)  //判断高电平是否高于7.168ms如果高于则跳出等待和中断
   return;
 }
 
 //至此为起始信号检测
 
 TR0=0;
 TH0=0;
 for(i=0;i<4;i++)  //一次锁存红外接收的四个十六进制数到a[4]中
 {
  for(j=0;j<8;j++)
  {
   TR0=1;
   while(!js)  //判断低电平宽度是否大于3..40ms
   {
    delay(5);
    if(TH0>15)
     return;
   }
   TH0=0;
   while(js) //判断高电平是否大于1.012ms如果高于则为接受到1,否则为0
   {
    delay(5);
    if(TH0>15)
     return;
   }
   TR0=0;
   CY=0;
   k=(k>>1);
   if(TH0>4)
    k=k+0x80;
   TH0=0;
  }
  a[i]=k;
 }
}


原文链接:http://blog.csdn.net/nuptboyzhb/article/details/6057535
加载中
返回顶部
顶部