⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 display.c

📁 AVR Mega128 按键菜单显示程序 源码 采用定时器调度算法
💻 C
📖 第 1 页 / 共 3 页
字号:
			  {0x10,0x13,0x10,0x7c,0x10,0x10,0xfd,0x12,
			   0x08,0xfc,0x88,0x88,0x88,0xa8,0x10,0x10,
			   0x51,0x5d,0x51,0x51,0x71,0x48,0x87,0x00,
			   0xf8,0x08,0x08,0x08,0xf8,0x06,0xfc,0x00},//超
			  {0x20,0x24,0x3a,0x42,0x40,0xf8,0x26,0x22,
			   0x10,0x14,0xfe,0x20,0x50,0x94,0xfe,0x10,
			   0xfa,0x22,0x23,0x2a,0x32,0x25,0x08,0x00,
			   0x10,0x14,0xfe,0x10,0x10,0x16,0xfc,0x00},//链
			  {0x04,0x7e,0x44,0x45,0x46,0x44,0x7c,0x50,
			   0x40,0x40,0xfc,0x88,0x50,0x20,0x50,0x8e,
			   0x13,0x5d,0x51,0x51,0x51,0x5d,0xe1,0x01,
			   0x04,0xfe,0x04,0x04,0x04,0x04,0xfc,0x04},//路
			  {0x14,0x7f,0x10,0x3f,0x55,0x1d,0x03,0xff,
			   0x40,0x7c,0xc8,0x28,0x10,0x6e,0x04,0xfe,
			   0x00,0x1f,0x00,0x1f,0x00,0x1f,0x10,0x1f,
			   0x00,0xf0,0x00,0xf0,0x00,0xf0,0x10,0xf0},//警
			  {0x01,0x11,0x11,0x1f,0x11,0x21,0x01,0xff,
			   0x00,0x00,0x10,0xf8,0x00,0x00,0x04,0xfe,
			   0x00,0x1f,0x10,0x10,0x10,0x10,0x1f,0x10,
			   0x10,0xf8,0x10,0x10,0x10,0x10,0xf0,0x10},//告
			  {0x00,0xff,0x00,0x00,0x01,0x01,0x03,0x05,
			   0x04,0xfe,0x80,0x80,0x00,0x00,0x40,0x20,
			   0x09,0x11,0x21,0x41,0x01,0x01,0x01,0x01,
			   0x18,0x0c,0x04,0x00,0x00,0x00,0x00,0x00},//不
			  {0x00,0x7f,0x01,0x01,0x01,0x01,0x11,0x11,
			   0x08,0xfc,0x00,0x00,0x00,0x00,0x10,0xf8,
			   0x11,0x11,0x11,0x11,0x11,0x11,0xff,0x00,
			   0x00,0x00,0x00,0x00,0x00,0x04,0xfe,0x00},//正
			  {0x0f,0x08,0x08,0x0f,0x08,0x08,0x0f,0x00,
			   0xe0,0x20,0x20,0xe0,0x20,0x20,0xe0,0x04,
			   0xff,0x01,0x09,0x09,0x09,0x15,0x23,0x40,
			   0xfe,0x00,0x20,0xf0,0x00,0x00,0x06,0xfc},//是
			  {0x00,0x3f,0x01,0xff,0x01,0x1f,0x11,0x1f,
			   0x38,0xc0,0x04,0xfe,0x10,0xf8,0x10,0xf0,
			   0x11,0x1f,0x01,0x3f,0x01,0x01,0xff,0x00,
			   0x10,0xf0,0x00,0xf8,0x00,0x04,0xfe,0x00},//重
			  {0x10,0x10,0x10,0x14,0xfe,0x11,0x12,0x10,
			   0x40,0x40,0x40,0x44,0xfe,0x08,0x88,0x88,
			   0x7c,0x44,0x44,0x44,0x44,0x7c,0x44,0x03,
			   0x88,0x88,0x50,0x20,0x20,0x50,0x8e,0x04},//故
			  {0x00,0x7b,0x49,0x50,0x57,0x60,0x53,0x4a,
			   0x40,0xf8,0x10,0xa4,0xfe,0x08,0xfc,0x08,
			   0x4b,0x4a,0x6b,0x50,0x4f,0x40,0x40,0x40,
			   0xf8,0x08,0xf8,0x40,0xfe,0x40,0x40,0x40},//障
			  {0x04,0x07,0x08,0x14,0x23,0x02,0x0C,0x30,
			   0x00,0xF0,0x20,0x40,0x80,0x80,0x60,0x1E,
			   0xDF,0x11,0x11,0x1F,0x11,0x11,0x1F,0x10,
			   0xF4,0x10,0x10,0xF0,0x10,0x10,0xF0,0x10},//备
			  {0x08,0x08,0x0F,0x10,0x10,0x37,0x50,0x90,
			   0x80,0x44,0xFE,0x00,0x08,0xFC,0x00,0x08,
			   0x17,0x10,0x13,0x12,0x12,0x12,0x13,0x12,
			   0xFC,0x00,0xF8,0x08,0x08,0x08,0xF8,0x08},//信
			  {0x00,0x47,0x34,0x14,0x84,0x65,0x25,0x0D,
			   0x04,0xFE,0x20,0x20,0x44,0xFE,0x04,0xFC,
			   0x15,0x25,0xE4,0x24,0x29,0x2A,0x30,0x20,
			   0x04,0xFC,0x20,0xA8,0xA6,0x22,0xA0,0x40},//源
			  {0x00,0x20,0x17,0x10,0x00,0x00,0xF0,0x13,
			   0x00,0x08,0xFC,0x08,0x08,0x08,0x08,0xF8,
			   0x12,0x12,0x12,0x12,0x16,0x1A,0x11,0x00,
			   0x08,0x00,0x00,0x02,0x02,0x02,0xFE,0x00},//记
			  {0x00,0x3F,0x00,0x00,0x1F,0x00,0x00,0xFF,
			   0x10,0xF8,0x10,0x10,0xF0,0x10,0x14,0xFE,
			   0x01,0x11,0x09,0x05,0x09,0x11,0x65,0x02,
			   0x08,0x10,0xA0,0x40,0x20,0x1E,0x04,0x00},//录
			  {0x08,0x08,0x08,0x10,0x17,0x30,0x52,0x92,
			   0x80,0x40,0x40,0x08,0xFC,0x00,0x08,0x08,
			   0x11,0x11,0x10,0x10,0x10,0x1F,0x10,0x10,
			   0x10,0x10,0x90,0xA0,0x24,0xFE,0x00,0x00},//位=74
			  {0x02,0x01,0x01,0x7F,0x01,0x01,0x01,0x01,
			   0x00,0x00,0x08,0xFC,0x00,0x00,0x00,0x10,
			   0x3F,0x01,0x01,0x01,0x01,0x01,0xFF,0x00,
			   0xF8,0x00,0x00,0x00,0x00,0x04,0xFE,0x00},//主=75
			  {0x01,0x02,0x0F,0x08,0x0F,0x08,0x0F,0x08,
			   0x00,0x10,0xF8,0x10,0xF0,0x10,0xF2,0x14,
			   0x08,0x7F,0x00,0x00,0x03,0x1C,0xE0,0x00,
			   0x18,0xF0,0x50,0x90,0x10,0x10,0x50,0x20},//身=76
			  {0x08,0x09,0x09,0x11,0x12,0x32,0x54,0x9B,
			   0x20,0x20,0x20,0x10,0x10,0x0E,0x04,0xF0,
			   0x11,0x11,0x11,0x11,0x12,0x12,0x14,0x10,
			   0x10,0x10,0x10,0x10,0x10,0x10,0xA0,0x40},//份=77
			  {0x20,0x13,0x12,0x02,0x02,0xF2,0x12,0x12,
			   0x08,0xFC,0x08,0x08,0x08,0x08,0x08,0x08,
			   0x13,0x12,0x10,0x15,0x19,0x12,0x04,0x08,
			   0xF8,0x08,0x00,0x20,0x10,0x08,0x04,0x04},//识=78
			  {0x01,0x3F,0x21,0x21,0x21,0x3F,0x28,0x09,
			   0x04,0x84,0x04,0x24,0x24,0x24,0x24,0x24,
			   0xFF,0x09,0x09,0x11,0x11,0x25,0x42,0x00,
			   0xA4,0x24,0x24,0x24,0x04,0x04,0x14,0x08},//别=79
			  {0x00,0x00,0x3F,0x20,0x20,0x20,0x20,0x20,
			   0x00,0x08,0xFC,0x08,0x08,0x08,0x08,0x08,
			   0x20,0x20,0x20,0x20,0x3F,0x20,0x00,0x00,
			   0x08,0x08,0x08,0x08,0xF8,0x08,0x00,0x00},//口=80
			  {0x01,0x01,0x02,0x04,0x0A,0x11,0x21,0xC0,
			   0x00,0x00,0x80,0x40,0x20,0x10,0x0E,0x04,
			   0x1F,0x00,0x00,0x04,0x02,0x01,0x00,0x00,
			   0xF0,0x10,0x20,0x40,0x80,0x00,0x80,0x80},//令=81
			  {0x11,0x11,0x11,0x21,0x2A,0x6C,0xA9,0x2E,
			   0x00,0x00,0xF8,0x10,0xA0,0x40,0xB0,0x2E,
			   0x28,0x2B,0x28,0x28,0x23,0x20,0x21,0x26,
			   0xC0,0x10,0x60,0x88,0x10,0x60,0x80,0x00},//修=82
			  {0x00,0x04,0xFE,0x04,0x04,0x05,0x7E,0x44,
			   0x80,0x80,0x80,0x84,0xFE,0x08,0x88,0x88,
			   0x40,0x40,0x40,0x40,0x4C,0x70,0x41,0x06,
			   0x88,0x50,0x50,0x20,0x50,0x88,0x0E,0x04},//改=83
			  {0x00,0x43,0x32,0x12,0x83,0x62,0x22,0x0B,
			   0x08,0xFC,0x08,0x08,0xF8,0x08,0x08,0xF8,
			   0x10,0x27,0xE4,0x24,0x24,0x24,0x2F,0x20,
			   0x00,0xFC,0xA4,0xA4,0xA4,0xA4,0xFE,0x00},//温=84
			  {0x01,0x00,0x3F,0x22,0x22,0x3F,0x22,0x23,
			   0x00,0x84,0xFE,0x20,0x28,0xFC,0x20,0xE0,
			   0x20,0x2F,0x22,0x21,0x20,0x43,0x8C,0x30,
			   0x00,0xF0,0x20,0x40,0x80,0x60,0x1E,0x04},//度=85
			  {0x12,0x13,0x24,0x49,0x9F,0x19,0x2F,0x69,
			   0x00,0xC4,0x9E,0x00,0xE0,0x20,0xFE,0x24,
			   0xAF,0x21,0x21,0x3F,0x22,0x24,0x28,0x20,
			   0xE4,0x04,0x24,0xF4,0x84,0x44,0x54,0x08},//衡=86
			  {0x04,0x7E,0x44,0x44,0x44,0x7E,0x11,0x10,
			   0xA0,0xA0,0xA0,0xA0,0xA4,0xAC,0xB0,0xA0,
			   0x5D,0x52,0x54,0x51,0x5D,0xF2,0x44,0x08,
			   0xB0,0xA8,0xA8,0x20,0x22,0x22,0x1E,0x00}//跳=87
 			 };
const unsigned char asc_88[ASC_NUMBER][8]=
                      {
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
{0x10,0x10,0x10,0x10,0x10,0x10,0x00,0x10},
{0x28,0x28,0x00,0x00,0x00,0x00,0x00,0x00},
{0x00,0x14,0x14,0x7E,0x28,0x7E,0x28,0x28},
{0x08,0x1C,0x2C,0x28,0x18,0x0C,0x2C,0x3C},
{0x00,0x64,0x68,0x68,0x7C,0x1C,0x1C,0x2C},
{0x00,0x30,0x30,0x3C,0x28,0x58,0x50,0x3C},
{0x20,0x40,0x00,0x00,0x00,0x00,0x00,0x00},
{0x08,0x10,0x10,0x10,0x10,0x10,0x10,0x08},
{0x20,0x10,0x10,0x10,0x10,0x10,0x10,0x20},
{0x00,0x10,0x54,0x38,0x38,0x54,0x10,0x00},
{0x00,0x10,0x10,0x7C,0x10,0x10,0x00,0x00},
{0x00,0x00,0x00,0x00,0x00,0x00,0x20,0x20},
{0x00,0x00,0x00,0x7C,0x00,0x00,0x00,0x00},
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x20},
{0x08,0x08,0x08,0x10,0x10,0x20,0x20,0x20},
{0x00,0x18,0x24,0x24,0x24,0x24,0x24,0x18},
{0x00,0x10,0x30,0x10,0x10,0x10,0x10,0x38},
{0x00,0x18,0x24,0x04,0x08,0x10,0x20,0x3C},
{0x00,0x18,0x24,0x04,0x18,0x04,0x24,0x18},
{0x08,0x08,0x18,0x28,0x48,0x7C,0x08,0x08},
{0x00,0x3C,0x20,0x38,0x04,0x04,0x24,0x18},
{0x00,0x38,0x40,0x40,0x78,0x44,0x44,0x38},
{0x00,0x3C,0x08,0x08,0x10,0x10,0x10,0x10},
{0x00,0x18,0x24,0x24,0x18,0x24,0x24,0x18},
{0x00,0x18,0x24,0x24,0x1C,0x04,0x04,0x18},
{0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x10},
{0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x10},
{0x00,0x04,0x08,0x10,0x20,0x10,0x08,0x04},
{0x00,0x00,0x00,0x7C,0x00,0x00,0x7C,0x00},
{0x00,0x20,0x10,0x08,0x04,0x08,0x10,0x20},
{0x18,0x24,0x24,0x08,0x10,0x10,0x00,0x10},
{0x00,0x38,0x4C,0x54,0x5C,0x54,0x44,0x38},
{0x00,0x10,0x10,0x28,0x28,0x38,0x28,0x6C},
{0x00,0x78,0x24,0x38,0x24,0x24,0x24,0x78},
{0x00,0x3C,0x44,0x40,0x40,0x40,0x44,0x38},
{0x00,0x78,0x24,0x24,0x24,0x24,0x24,0x78},
{0x00,0x7C,0x24,0x20,0x38,0x20,0x24,0x7C},
{0x00,0x7C,0x24,0x28,0x38,0x28,0x20,0x70},
{0x00,0x38,0x40,0x40,0x40,0x5C,0x48,0x30},
{0x00,0x76,0x24,0x24,0x3C,0x24,0x24,0x76},
{0x00,0x38,0x10,0x10,0x10,0x10,0x10,0x38},
{0x00,0x38,0x10,0x10,0x10,0x10,0x10,0x10},
{0x00,0x74,0x28,0x30,0x30,0x28,0x28,0x6C},
{0x00,0x70,0x20,0x20,0x20,0x20,0x24,0x7C},
{0x00,0x66,0x3C,0x3C,0x3C,0x34,0x24,0x66},
{0x00,0x6E,0x24,0x34,0x34,0x2C,0x24,0x74},
{0x00,0x38,0x44,0x44,0x44,0x44,0x44,0x38},
{0x00,0x78,0x24,0x24,0x38,0x20,0x20,0x70},
{0x00,0x38,0x44,0x44,0x44,0x74,0x4C,0x38},
{0x00,0x78,0x24,0x38,0x28,0x24,0x24,0x76},
{0x00,0x1C,0x24,0x20,0x18,0x04,0x24,0x38},
{0x00,0x7C,0x54,0x10,0x10,0x10,0x10,0x38},
{0x00,0x66,0x24,0x24,0x24,0x24,0x24,0x18},
{0x00,0x6C,0x28,0x28,0x28,0x28,0x10,0x10},
{0x00,0x7E,0x52,0x52,0x2C,0x2C,0x24,0x24},
{0x00,0x6C,0x28,0x28,0x10,0x28,0x28,0x6C},
{0x00,0x6C,0x28,0x28,0x10,0x10,0x10,0x38},
{0x00,0x7C,0x48,0x10,0x10,0x20,0x24,0x7C},
{0x1F,0x1F,0x18,0x18,0x18,0x18,0x1F,0x1F},
{0x20,0x20,0x20,0x10,0x10,0x08,0x08,0x08},
{0xF8,0xF8,0x18,0x18,0x18,0x18,0xF8,0xF8},
{0x28,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},
{0x00,0x00,0x00,0x30,0x48,0x38,0x48,0x3C},
{0x00,0x60,0x20,0x38,0x24,0x24,0x24,0x38},
{0x00,0x00,0x00,0x1C,0x24,0x20,0x20,0x1C},
{0x00,0x0C,0x04,0x1C,0x24,0x24,0x24,0x1E},
{0x00,0x00,0x00,0x18,0x24,0x3C,0x20,0x1C},
{0x00,0x0C,0x10,0x3C,0x10,0x10,0x10,0x38},
{0x00,0x00,0x00,0x3C,0x28,0x38,0x20,0x3C},
{0x00,0x60,0x20,0x38,0x24,0x24,0x24,0x76},
{0x00,0x10,0x00,0x30,0x10,0x10,0x10,0x38},
{0x00,0x08,0x00,0x18,0x08,0x08,0x08,0x08},
{0x00,0x60,0x20,0x2C,0x28,0x30,0x28,0x6C},
{0x00,0x30,0x10,0x10,0x10,0x10,0x10,0x38},
{0x00,0x00,0x00,0x78,0x54,0x54,0x54,0x54},
{0x00,0x00,0x00,0x78,0x24,0x24,0x24,0x76},
{0x00,0x00,0x00,0x38,0x44,0x44,0x44,0x38},
{0x00,0x00,0x00,0x78,0x24,0x24,0x24,0x38},
{0x00,0x00,0x00,0x1C,0x24,0x24,0x24,0x1C},
{0x00,0x00,0x00,0x34,0x18,0x10,0x10,0x38},
{0x00,0x00,0x00,0x3C,0x20,0x18,0x04,0x3C},
{0x00,0x10,0x10,0x38,0x10,0x10,0x10,0x08},
{0x00,0x00,0x00,0x6C,0x24,0x24,0x24,0x1E},
{0x00,0x00,0x00,0x6C,0x28,0x28,0x28,0x10},
{0x00,0x00,0x00,0x6F,0x2A,0x2A,0x36,0x14},
{0x00,0x00,0x00,0x7C,0x28,0x10,0x28,0x7C},
{0x00,0x00,0x00,0x7C,0x28,0x10,0x10,0x20},
{0x00,0x00,0x00,0x3C,0x08,0x08,0x10,0x3C},
{0x08,0x08,0x08,0x18,0x08,0x08,0x08,0x08},
{0x08,0x08,0x08,0x08,0x08,0x08,0x08,0x08},
{0x10,0x10,0x10,0x18,0x10,0x10,0x10,0x10},
{0x52,0x0C,0x00,0x00,0x00,0x00,0x00,0x00},
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}
			          };

void tobcd(unsigned int data,unsigned char* data_c)
{
 unsigned int i;
 unsigned long coe;
 unsigned char flag;
 
 if(data>9999)
   {
    data=9999;
   }
 coe=1000;
 flag=0;
 for(i=0;i<5;i++)
   {
	if(i==3) *(data_c+(i++))='.';
	*(data_c+i)=(data/coe)+0x30;
	if(((*(data_c+i))!=0x30)||(coe==10)) flag=1;
	else if(!flag) *(data_c+i)=' ';
	data%=coe;
    coe/=10;
   }
}
					  
void chk_sta01(void)
{
  	 unsigned char *address=(unsigned char*)LCD_AD;
	 unsigned char temp;

	 PORTE|=1<<LCD_CD;
	 while(((temp=*address)&0x03)!=0x03);
	 	 
}

void chk_sta2(void)
{
  	 unsigned char *address=(unsigned char*)LCD_AD;
	 unsigned char temp;

	 PORTE|=1<<LCD_CD;
	 while(((temp=*address)&0x04)!=0x04);
	 	 
}

void chk_sta3(void)
{
  	 unsigned char *address=(unsigned char*)LCD_AD;
	 unsigned char temp;

	 PORTE|=1<<LCD_CD;
	 while(((temp=*address)&0x08)!=0x08);
	 	 
}

unsigned char r_data(void)
{
 	 unsigned char *address=(unsigned char*)LCD_AD;
	 unsigned char temp,temp1;
	 
	 chk_sta2();
	 PORTE&=~(1<<LCD_CD);
	 temp1=*address;
	 return temp1;
}

void w_data2(unsigned char data_l,unsigned char data_h)
{
 	 unsigned char *address=(unsigned char*)LCD_AD;
	 unsigned char temp;
	 
	 chk_sta01();
	 PORTE&=~(1<<LCD_CD);
	 *address=data_l;
	 chk_sta01();
	 PORTE&=~(1<<LCD_CD);
	 *address=data_h;
}

void w_data(unsigned char data)
{
 	 unsigned char *address=(unsigned char*)LCD_AD;
	 unsigned char temp;
	 
	 chk_sta01();
	 PORTE&=~(1<<LCD_CD);
	 *address=data;
}

void w_cmd(unsigned char commend)
{
 	 unsigned char *address=(unsigned char*)LCD_AD;
	 unsigned char temp;
	 
	 chk_sta01();
	 PORTE|=1<<LCD_CD;
	 *address=commend;
}

void set_ADP(unsigned int adp)
	 {
	  unsigned char data_l;
	  unsigned char data_h;
	  unsigned int  temp;
	  //set ADP
	  temp=adp;
	  temp&=0x00ff;
	  data_l=(unsigned char)temp;
	  temp=adp;
	  temp=temp>>8;
	  temp&=0x00ff;
	  data_h=(unsigned char)temp;
	  w_data2(data_l,data_h);
	  w_cmd(ADPSET);
	 }

void m_fill(unsigned int adp,unsigned char data)
{
 	set_ADP(adp);
	w_data(data);
	w_cmd(MWR);
}

void auto_fill(unsigned char data)
{
 	 unsigned char *address=(unsigned char*)LCD_AD;
	 unsigned char temp;
	 
	 chk_sta3();
	 PORTE&=~(1<<LCD_CD);
	 *address=data;
}

unsigned int qtr_write(unsigned int adp,unsigned char data)
{
      unsigned int adp_temp;
	  unsigned char num;
	  unsigned int i;
 
      adp_temp=adp;
	  num=data-0x20;

	  for(i=0;i<8;i++)
	  {
	   m_fill(adp_temp,asc_88[num][i]);
	   adp_temp+=0x0010;
	  }
	  adp++;
	  return adp;
}

unsigned int half_write(unsigned int adp,unsigned char data)
{
      unsigned int adp_temp;
	  unsigned char num;
	  unsigned int i;
 
      adp_temp=adp;
	  num=data-0x20;

	  for(i=0;i<16;i++)
	  {
	   m_fill(adp_temp,asc[num][i]);
	   adp_temp+=0x0010;
	  }
	  adp++;
	  return adp;
}

unsigned int full_write(unsigned int adp,unsigned char data,unsigned char data1)
{
	 unsigned int temp=0;
	 unsigned int adp_temp;
	 unsigned int num;
	 unsigned int i,j;
	 
	 adp_temp=adp;
	 temp=(temp|(unsigned int)data)<<8;
	 temp|=(unsigned int)data1;
	 num=temp-0x8000;
	 
	 for(i=0;i<32;)
   	    {
		 if((i>=0)&&(i<8))
		   adp_temp=adp+0x0000;
		 else if((i>=8)&&(i<16))
		   adp_temp=adp+0x0001;
		 else if((i>=16)&&(i<24))
		   adp_temp=adp+0x0080;
		 else if((i>=24)&&(i<32))

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -