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

📄 c5112864a.html

📁 C51例程代码
💻 HTML
📖 第 1 页 / 共 3 页
字号:
<html><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312"><title>单片机编程世界——编程实战</title><meta name="GENERATOR" content="Microsoft FrontPage 3.0"><style><!-- a {text-decoration:none}a:hover {color:red;font-weight:bold;text-decoration:underline}--></style></head><script language="JavaScript1.2">NS4 = (document.layers) ? 1 : 0;IE4 = (document.all) ? 1 : 0;ver4 = (NS4 || IE4) ? 1 : 0;if (ver4) {  with (document) {      write("<STYLE TYPE='text/css'>");      if (NS4) {          write(".parent {position:absolute; visibility:visible}");          write(".child {position:absolute; visibility:visible}");          write(".regular {position:absolute; visibility:visible}")      }      else {          write(".child {display:none}")      }      write("</STYLE>");  }}function arrange() {  nextY = document.layers[firstInd].pageY +document.layers[firstInd].document.height;  for (i=firstInd+1; i<document.layers.length; i++) {      whichEl = document.layers[i];      if (whichEl.visibility != "hide") {          whichEl.pageY = nextY;          nextY += whichEl.document.height;      }  }}function initIt(){  if (!ver4) return;  if (NS4) {      for (i=0; i<document.layers.length; i++) {          whichEl = document.layers[i];          if (whichEl.id.indexOf("Child") != -1) whichEl.visibility = "hide";     }      arrange();  }  else {      divColl = document.all.tags("DIV");      for (i=0; i<divColl.length; i++) {          whichEl = divColl(i);          if (whichEl.className == "child") whichEl.style.display = "none";      }  }}function expandIt(el) {  if (!ver4) return;  if (IE4) {      whichEl = eval(el + "Child");      if (whichEl.style.display == "none") {          whichEl.style.display = "block";      }      else {          whichEl.style.display = "none";      }  }  else {      whichEl = eval("document." + el + "Child");      if (whichEl.visibility == "hide") {          whichEl.visibility = "show";      }      else {          whichEl.visibility = "hide";      }      arrange();  }}onload = initIt;</script><body background="image\weave.gif"><p>/********************************************************************/</p><p align="center"><br>GLCD.C: 12864A 128X64 dots Graphic Type STN dot&nbsp; matrix LCD Module Subroutine </p><p align="center"><a href="mailto:mcushow@yeah.net">易兵</a> </p><p align="center">版权<a href="mailto:mcu21cn@371.net">一冰软件工作室</a></p><p>/********************************************************************/<br>#define LcdDataPort PioPortB<br>#define LcdCtrlPort PioPortC<br><br>/* Bit Address Assignment*/<br>#define LcdRegPin 0x01 /* bit 0 of the port */<br>#define LcdRWPin 0x02 /* bit 1 of the port */<br>#define LcdEnablePin 0x04 /* bit 2 of the port */<br>#define LcdCS1Pin 0x08 /* bit 3 of the port */<br>#define LcdCS2Pin 0x10 /* bit 4 of the port */<br>#define LcdELPin 0x20 /* bit 5 of the port */<br><br>/* for Lcd System */<br>unsigned char lcd_row, lcd_column;<br>unsigned char lcd_hrow,lcd_hcolumn,lcd_ascii;<br>unsigned char lcd_x;<br>bit lcd_color;<br>char TranDec[4];<br>code char Bit_table[]={0x01,0x02,0x04,0x08,0x10,0x20,0x40,0x80};<br><br>code char Hex_table[]={'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'};<br><br>code char Char_Bit[][6]={<br>{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, /* */<br>{ 0x00, 0x00, 0x4F, 0x00, 0x00, 0x00}, /* ! */<br>{ 0x00, 0x04, 0x03, 0x04, 0x03, 0x00}, /* &quot; */<br>{ 0x14, 0x7F, 0x14, 0x7F, 0x14, 0x00}, /* # */<br>{ 0x24, 0x2A, 0x7F, 0x2A, 0x12, 0x00}, /* $ */<br>{ 0x23, 0x13, 0x08, 0x64, 0x62, 0x00}, /* % */<br>{ 0x36, 0x49, 0x56, 0x20, 0x58, 0x00}, /* &amp; */<br>{ 0x00, 0x00, 0x05, 0x03, 0x00, 0x00}, /* ' */<br>{ 0x00, 0x1C, 0x22, 0x41, 0x00, 0x00}, /* ( */<br>{ 0x00, 0x41, 0x22, 0x1C, 0x00, 0x00}, /* ) */<br>{ 0x22, 0x14, 0x7F, 0x14, 0x22, 0x00}, /* * */<br>{ 0x08, 0x08, 0x3E, 0x08, 0x08, 0x00}, /* + */<br>{ 0x00, 0x00, 0x28, 0x18, 0x00, 0x00}, /* , */<br>{ 0x08, 0x08, 0x08, 0x08, 0x08, 0x00}, /* - */<br>{ 0x00, 0x00, 0x60, 0x60, 0x00, 0x00}, /* . */<br>{ 0x20, 0x10, 0x08, 0x04, 0x02, 0x00}, /* / */<br>{ 0x3e, 0x51, 0x49, 0x45, 0x3e, 0x00}, /* 0 */<br>{ 0x00, 0x42, 0x7f, 0x40, 0x00, 0x00}, /* 1 */<br>{ 0x42, 0x61, 0x51, 0x49, 0x46, 0x00}, /* 2 */<br>{ 0x21, 0x41, 0x45, 0x4B, 0x31, 0x00}, /* 3 */<br>{ 0x18, 0x14, 0x12, 0x7F, 0x10, 0x00}, /* 4 */<br>{ 0x27, 0x45, 0x45, 0x45, 0x39, 0x00}, /* 5 */<br>{ 0x3C, 0x4A, 0x49, 0x49, 0x30, 0x00}, /* 6 */<br>{ 0x01, 0x01, 0x71, 0x0D, 0x03, 0x00}, /* 7 */<br>{ 0x36, 0x49, 0x49, 0x49, 0x36, 0x00}, /* 8 */<br>{ 0x06, 0x49, 0x49, 0x29, 0x1E, 0x00}, /* 9 */<br>{ 0x00, 0x00, 0x36, 0x36, 0x00, 0x00}, /* : */<br>{ 0x00, 0x00, 0x56, 0x36, 0x00, 0x00}, /* ; */<br>{ 0x00, 0x08, 0x14, 0x22, 0x41, 0x00}, /* &lt; */<br>{ 0x00, 0x14, 0x14, 0x14, 0x14, 0x00}, /* = */<br>{ 0x00, 0x41, 0x22, 0x14, 0x08, 0x00}, /* &gt; */<br>{ 0x02, 0x01, 0x51, 0x09, 0x06, 0x00}, /* ? */<br>{ 0x3E, 0x41, 0x5D, 0x55, 0x3E, 0x00}, /* @ */<br>{ 0x7C, 0x12, 0x11, 0x12, 0x7C, 0x00}, /* A */<br>{ 0x7F, 0x49, 0x49, 0x49, 0x36, 0x00}, /* B */<br>{ 0x3E, 0x41, 0x41, 0x41, 0x22, 0x00}, /* C */<br>{ 0x7F, 0x41, 0x41, 0x22, 0x1C, 0x00}, /* D */<br>{ 0x7F, 0x49, 0x49, 0x49, 0x41, 0x00}, /* E */<br>{ 0x7F, 0x09, 0x09, 0x09, 0x01, 0x00}, /* F */<br>{ 0x3E, 0x41, 0x49, 0x49, 0x7A, 0x00}, /* G */<br>{ 0x7F, 0x08, 0x08, 0x08, 0x7F, 0x00}, /* H */<br>{ 0x00, 0x41, 0x7f, 0x41, 0x00, 0x00}, /* I */<br>{ 0x20, 0x40, 0x41, 0x3F, 0x01, 0x00}, /* J */<br>{ 0x7F, 0x08, 0x14, 0x22, 0x41, 0x00}, /* K */<br>{ 0x7F, 0x40, 0x40, 0x40, 0x40, 0x00}, /* L */<br>{ 0x7F, 0x02, 0x0C, 0x02, 0x7F, 0x00}, /* M */<br>{ 0x7F, 0x04, 0x08, 0x10, 0x7F, 0x00}, /* N */<br>{ 0x3E, 0x41, 0x41, 0x41, 0x3E, 0x00}, /* O */<br>{ 0x7F, 0x09, 0x09, 0x09, 0x06, 0x00}, /* P */<br>{ 0x3E, 0x41, 0x51, 0x21, 0x5E, 0x00}, /* Q */<br>{ 0x7F, 0x09, 0x19, 0x29, 0x46, 0x00}, /* R */<br>{ 0x26, 0x49, 0x49, 0x49, 0x32, 0x00}, /* S */<br>{ 0x01, 0x01, 0x7f, 0x01, 0x01, 0x00}, /* T */<br>{ 0x3F, 0x40, 0x40, 0x40, 0x3F, 0x00}, /* U */<br>{ 0x1F, 0x20, 0x40, 0x20, 0x1F, 0x00}, /* V */<br>{ 0x3F, 0x40, 0x38, 0x40, 0x3F, 0x00}, /* W */<br>{ 0x63, 0x14, 0x08, 0x14, 0x63, 0x00}, /* X */<br>{ 0x03, 0x04, 0x78, 0x04, 0x03, 0x00}, /* Y */<br>{ 0x61, 0x51, 0x49, 0x45, 0x43, 0x00}, /* Z */<br>{ 0x00, 0x7F, 0x41, 0x41, 0x00, 0x00}, /* [ */<br>{ 0x02, 0x04, 0x08, 0x10, 0x20, 0x00}, /* \ */<br>{ 0x00, 0x41, 0x41, 0x7F, 0x00, 0x00}, /* ] */<br>{ 0x10, 0x08, 0x04, 0x08, 0x10, 0x00}, /* ^ */<br>{ 0x40, 0x40, 0x40, 0x40, 0x40, 0x00}}; /* _ */<br>/*汉字点阵*/<br>code Hchar_Bit[][32]={{0x00,0x08,0x24,0xa2,0xff,0xa1,0x20,0x00,0x40,0x5e,<br>0x52,0xd2,0x52,0x5e,0x40,0x00,0x00,0x04,0x02,0x01,<br>0x1f,0x01,0x02,0x00,0x12,0x12,0x12,0x1f,0x12,0x12,<br>0x12,0x00},{0x00,0x00,0xfb,0x04,0x54,0x54,0x54,0x57,0xff,0x54,0x54,0x54,0xf2,0x44,0x44,0x00,<br>0x00,0x00,0xff,0x00,0x79,0x29,0x29,0x29,0x2f,0x29,0x29,0x29,0x79,0x00,0x00,0x00},<br><br>{0x00,0xf0,0x00,0xfe,0x20,0x10,0x48,0x48,0x48,0xff,0x48,0x48,0x48,0x48,0x08,0x00,<br>0x00,0x40,0x38,0x07,0x04,0x08,0x12,0x02,0x02,0x7f,0x02,0x02,0x22,0x22,0x1e,0x00},<br>{0x00,0x40,0x20,0x98,0x8e,0x8a,0x88,0x88,0xf8,0x88,0x88,0x88,0x88,0x08,0x00,0x00,<br>0x00,0x08,0x08,0x0f,0x08,0x08,0x08,0x08,0xff,0x08,0x08,0x08,0x08,0x08,0x08,0x00},<br>{0x00,0x10,0x08,0x84,0x42,0x20,0x00,0x40,0x44,0x44,0x44,0x44,0xc4,0x44,0x44,0x40,<br>0x00,0x02,0x01,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0xc0,0xff,0x00,0x00,0x00},<br><br><br>{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xfc,0x40,0x40,0x40,0x40,0x40,0x40,0x00,0x00,<br>0x00,0x40,0x40,0x40,0x40,0x40,0x40,0x7f,0x40,0x40,0x40,0x40,0x40,0x40,0x40,0x00},<br>{0x00,0x84,0x84,0xfc,0x84,0x84,0xf0,0x00,0xfe,0x00,0x00,0x84,0xfc,0x84,0x84,0x04,<br>0x00,0x20,0x30,0x1f,0x10,0x10,0x61,0x10,0x0f,0x20,0x20,0x20,0x3f,0x20,0x20,0x20},<br>{0x00,0x02,0x02,0x02,0x02,0x02,0x02,0xfe,0x12,0x22,0x42,0x82,0x02,0x02,0x02,0x00,<br>0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3f,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},<br><br><br>{0x00,0x40,0x42,0xcc,0x00,0x00,0x00,0xfe,0x22,0x22,0x22,0x22,0x22,0x7e,0x00,0x00,<br>0x00,0x20,0x10,0x1f,0x10,0x24,0x22,0x21,0x20,0x20,0x21,0x22,0x24,0x28,0x20,0x00},<br>{0x00,0x62,0x52,0x4a,0xc6,0x42,0x52,0x62,0x80,0x00,0xfc,0x00,0x00,0xff,0x00,0x00,<br>0x00,0x22,0x12,0x12,0x1f,0x12,0x12,0x12,0x00,0x00,0x07,0x20,0x20,0x3f,0x00,0x00}<br><br><br><br>};<br><br>void LcdDelay(void); /* 延时 */<br>void LcdDelay()<br>{ <br>&nbsp;&nbsp; data char i;<br>&nbsp;&nbsp; for (i=0;i&lt;10;i++);<br>}<br>void LcdBacklight(bit); /* 背光 */<br>void LcdBacklight(bit on)<br>{ <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (on)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; LcdCtrlPort = LcdCtrlPort | LcdELPin;<br>&nbsp;&nbsp;&nbsp; else<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; LcdCtrlPort = LcdCtrlPort &amp; (LcdELPin^0xff);<br>}<br><br>void LcdCmd(char); /* LCD命令 */<br>void LcdCmd(char c)<br>{<br>&nbsp;&nbsp;&nbsp; PioCon = 0x0c|0x02|0x00;<br>&nbsp;&nbsp;&nbsp; /* Input Output<br>&nbsp;&nbsp;&nbsp; Port A = 0x00 0x01<br>&nbsp;&nbsp;&nbsp; Port B = 0x00 0x02<br>&nbsp;&nbsp;&nbsp; Port C = 0x00 0x0c<br>&nbsp;&nbsp;&nbsp; Counter = Disable<br>&nbsp;&nbsp;&nbsp; */<br>&nbsp;&nbsp;&nbsp; LcdDataPort = c;<br>&nbsp;&nbsp;&nbsp; LcdCtrlPort = LcdCtrlPort &amp; (LcdRegPin^0xff);<br>&nbsp;&nbsp;&nbsp; LcdCtrlPort = LcdCtrlPort &amp; (LcdRWPin^0xff);<br>&nbsp;&nbsp;&nbsp; LcdCtrlPort = LcdCtrlPort | LcdCS1Pin;<br>&nbsp;&nbsp;&nbsp; LcdCtrlPort = LcdCtrlPort | LcdCS2Pin;<br>&nbsp;&nbsp;&nbsp; LcdCtrlPort = LcdCtrlPort | LcdEnablePin;<br>&nbsp;&nbsp;&nbsp; LcdDelay();<br>&nbsp;&nbsp;&nbsp; LcdCtrlPort = LcdCtrlPort &amp; (LcdEnablePin^0xff);<br>&nbsp;&nbsp;&nbsp; LcdDelay();<br>}<br>void LcdData(char); /* 赋LCD数据 */<br>void LcdData(char c)<br>{<br>&nbsp;&nbsp;&nbsp; PioCon = 0x0c|0x02|0x00;<br>&nbsp;&nbsp;&nbsp; /* Input Output<br>&nbsp;&nbsp;&nbsp; Port A = 0x00 0x01<br>&nbsp;&nbsp;&nbsp; Port B = 0x00 0x02<br>&nbsp;&nbsp;&nbsp; Port C = 0x00 0x0c<br>&nbsp;&nbsp;&nbsp; Counter = Disable<br>&nbsp;&nbsp;&nbsp; */<br>&nbsp;&nbsp;&nbsp; LcdDataPort = c;<br>&nbsp;&nbsp;&nbsp; LcdCtrlPort = LcdCtrlPort | LcdRegPin;<br>&nbsp;&nbsp;&nbsp; LcdCtrlPort = LcdCtrlPort &amp; (LcdRWPin^0xff);<br>&nbsp;&nbsp;&nbsp; LcdCtrlPort = LcdCtrlPort | LcdCS1Pin;<br>&nbsp;&nbsp;&nbsp; LcdCtrlPort = LcdCtrlPort | LcdCS2Pin;<br>&nbsp;&nbsp;&nbsp; LcdCtrlPort = LcdCtrlPort | LcdEnablePin;<br>&nbsp;&nbsp;&nbsp; LcdDelay();<br>&nbsp;&nbsp;&nbsp; LcdCtrlPort = LcdCtrlPort &amp; (LcdEnablePin^0xff);<br>&nbsp;&nbsp;&nbsp; LcdDelay();<br>

⌨️ 快捷键说明

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