ÄãµÄλÖ㺠Ê×Ò³ > ¼¼Êõ·þÎñ >
µãÕóÒº¾§ÆÁ¼¼Êõ·þÎñ

1602µãÕó×Ö·ûÒº¾§Ä£¿éÉè¼Æ¼°¸÷¹¦ÄÜ×Ó³ÌÐò

·¢²¼Ê±¼ä£º18-08-31

1602×Ö·ûÐÍÒº¾§Ò²½Ð1602Òº¾§£¬ËüÊÇÒ»ÖÖרÃÅÓÃÀ´ÏÔʾ×Öĸ¡¢Êý×Ö¡¢·ûºÅµÈµÄµãÕóÐÍÒº¾§Ä£¿é¡£×Ö·ûÐÍÒº¾§£¬Äܹ»Í¬Ê±ÏÔʾ16x02¼´32¸ö×Ö·û¡£

1602µãÕó×Ö·ûÒº¾§Ä£¿éÉè¼Æ¼°¸÷¹¦ÄÜ×Ó³ÌÐò

ҪʵÏÖ¶Ô1602µãÕó×Ö·ûÒº¾§Ä£¿éµÄ¸ßЧ¿ØÖÆ£¬±ØÐë°´ÕÕÄ£¿éÉè¼Æ·½Ê½£¬½¨Á¢ÆðÏà¹ØµÄ×Ó³ÌÐò£¬ÏÂÃæÏêϸ½éÉÜÇý¶¯1602µãÕó×Ö·ûÒº¾§Ä£¿éµÄ¸÷¹¦ÄÜ×Ó³ÌÐò¡£
 
1£®Ð´ÃüÁîµ½LCM×Óº¯Êý
 
vOid LCDWriteCommand(uchar CMD£¬uchar Attribc)
 
/*º¯ÊýÃûΪWriteCommandLCMµÄдָÁîµ½LCM×Óº¯Êý¡£
 
¶¨ÒåCMD¡¢AttribcΪÎÞ·ûºÅ×Ö·ûÐͱäÁ¿¡£*/
 
{
 
if(Attribc)WaitForEnable()£»
 
/*ÈôArrribcΪ“Õ攣¬Ôòµ÷ÓÃWaitForEnable×Óº¯Êý½øÐÐæ¼ì²â*/
 
LCM_RS_0£»LCM_RW_0£»_NOP0£»
 
/*Ñ¡ÖÐÖ¸Áî¼Ä´æÆ÷£¬Ð´Ä£Ê½*/
 
DataPort=CMD£»_NOP()£»
 
/*½«±äÁ¿WCLCMÖеÄÖ¸Áî´«ËÍÖÁÊý¾Ý¿Ú
 
LCM_EN_1£»_NOP0£»_NOP()£»LCM_EN_O£º
 
/*LCM_EN¶Ë²úÉúÂö³åϽµÑØ¡£*/
 
}
 
/*WriteCommandLCM×Óº¯Êý½áÊø¡£*/
 
2£¬Ð´Êý¾Ýµ½LCM×Óº¯Êý
 
void LcdWritEDAta(dchar dataW)
 
/*º¯ÊýÃûΪWriteDataLCMµÄдÊý¾Ýµ½LCM×Óº¯Êý¡£¶¨Òå
 
dataWΪÎÞ·ûºÅ×Ö·ûÐͱäÁ¿¡£*/
 
{
 
£¯*WriteDataLCM×Óº¯Êý¿ªÊ¼¡£*/
 
WaitForEnable()£»*/
 
LCM_RS_1£»LCM_RW_0£»_NOP0£»
 
/*Ñ¡ÖÐÊý¾Ý¼Ä´æÆ÷£¬Ð´Ä£Ê½¡£*/
 
DataPort=dataW£»_NOP()£»
 
/*½«±äÁ¿dataQWÖÐÊý¾Ý´«ËÍÖÁÊý¾Ý¿Ú¡£*/
 
LCM_EN_1£»_NOP()£»_NOP0£»LCM_EN_O£º
 
/*LCM_EN¶Ë²úÉúÂö³åϽµÑØ¡£WriteDataLCM×Óº¯Êý
 
½áÊø*£¯
 
3£®¼ì²âLCDæÐźÅ×Óº¯Êý
 
void WaitForEnable(void)
 
£¯*º¯ÊýÃûΪWaitForEnableµÄ¼ì²âæÐźÅ×Ó³ÌÐò×Óº¯Êý¡£
 
/*WaitForEnable×Óº¯Êý¿ªÊ¼¡£*/
 
uchar val£»
 
/*¶¨Òå¾Ö²¿±äÁ¿val¡£*/
 
DataPOrt=Oxff£»
 
/*ÖÃÊý¾Ý¿ÚΪȫ1¡£*/
 
LCM_RS_0£»LCM_RW_1£»_NOP()£»
 
/*Ñ¡ÖÐÖ¸Áî¼Ä´æÆ÷£¬¶Áģʽ¡£*/
 
LCM_EN_1£»_NOP()£»_NOP()£»
 
/*ÖÃLCM_EN¶ËΪ¸ßµçƽ£¬¶ÁʹÄÜ¡£*/
 
DDRA=0x00£»
 
/*Êý¾Ý¿ÚÖÃΪÊäÈë*/
 
val=PINA£º
 
/*¶ÁÈ¡Êý¾Ý*/
 
while(val&Busy)val=PINA£º
 
/*¼ì²âæÐźš£µ±Êý¾Ý¿ÚÄÚÈÝÓë0x80ÏàÓëºó²»ÎªÁãʱ£¬
 
³ÌÐòÔ­µØ̤²½¼ÌÐø¶ÁÈ¡Êý¾Ý²¢¼ì²âæÐźš£*/
 
LCM_EN_O£º
 
/*ÖÃLCM_EN¶ËΪµÍµçƽ¡£*/
 
DDRA=0xff£»
 
/*Êý¾Ý¿ÚÖÃΪÊä³ö*/
 
}
 
/*WaitForEnable×Óº¯Êý½áÊø¡£*/
 
4£®ÏÔʾ¹â±ê¶¨Î»×Óº¯Êý
 
void LOCateXY(char posx£®char posy)
 
/*ÏÔʾ¹â±ê¶¨Î»×Óº¯Êý£¬º¯ÊýÃûΪLocareXY£¬¶¨Òåposx,
 
posxxyΪ×Ö·ûÐͱäÁ¿¡£*/
 
{
 
/*LocateXY×Óº¯Êý¿ªÊ¼¡£*/
 
uchar temp£»
 
/*¶¨ÒåtempΪÎÞ·ûºÅ×Ö·ûÐͱäÁ¿¡£*/
 
temp&=0x7f£»
 
/*tempµÄ±ä»¯·¶Î§0-15¡£*/
 
temp=posx&0xof£»
 
/*ÆÁ±Î¸ß4λ¡£*/
 
posy&=0x01£»
 
/*posyµÄ±ä»¯·¶Î§0-1¡£*/
 
if(posy)temp¨ç=0x40£»
 
/*ÈôposyΪ1(ÏÔʾµÚ¶þÐÐ)£¬µØÖ·Âë+0x40*/
 
temp¨ç=0x80£»
 
/*Ö¸ÁîÂëΪµØÖ·Âë+0x80¡£*/
 
WriteCommandLCM(temp£¬0)£»
 
£¯*½«Ö¸ÁîtempдÈëLCM£¬ºöÂÔæÐźżì²â¡£*£¯
 
}
 
/*LocateXY×Óº¯Êý½áÊø¡£*/
 
5£®ÏÔʾָ¶¨×ù±êµÄÒ»¸ö×Ö·û(x=0¡«15£¬y=0¡«1)×Óº¯Êý
 
void DisplayOneChar(uchar x£¬uchar y£¬uchar Wdata)
 
/*ÏÔʾָ¶¨×ù±êµÄÒ»¸ö×Ö·û(x=0-15.y=0-1)×Óº¯Êý£¬º¯
 
ÊýÃûΪDispOneChar£¬¶¨Òåx¡¢y¡¢WdataΪÎÞ·ûºÅ×Ö·ûÐͱäÁ¿¡£
 
*/
 
{
 
/*DispOneCharº¯Êý¿ªÊ¼*/
 
LocateXY(x£¬y)£º
 
£¯*µ÷ÓÃLocateXYº¯Êý¶¨Î»ÏÔʾµØÖ·¡£*£¯
 
WriteDataLCM(Wdata)£»
 
£¯*½«Êý¾ÝWdataдÈëLCM¡£*/
 
}
 
/*DispONeCharº¯Êý½áÊø¡£*£¯
 
6£®ÑÝʾµÚ¶þÐÐÒƶ¯×Ö·û´®×Óº¯Êý
 
void Display(uchar dd)
 
/*ÑÝʾµÚ¶þÐÐÒƶ¯×Ö·û´®×Óº¯Êý£¬º¯ÊýÃûΪDispiay£¬¶¨Òå
 
ddΪÎÞ·ûºÅ×Ö·ûÐͱäÁ¿¡£*/
 
{
 
/*Display×Óº¯Êý¿ªÊ¼¡£*/
 
uchari£º
 
/*¶¨Ò壻ΪÎÞ·ûºÅ×Ö·ûÐͱäÁ¿¡£*/

ÈÈÏú²úÆ·£ºµãÕóÒº¾§ÆÁ| ×Ö·ûµãÕóÒº¾§ÆÁ| ¶ÏÂëÒº¾§ÆÁ| ºÚ°×Òº¾§ÆÁ| COBµãÕóÒº¾§ÆÁ
COGµãÕóÒº¾§ÆÁ

º¼ÖÝÁ¢»Í¿Æ¼¼ÓÐÏÞ¹«Ë¾¡¡°æȨËùÓÐ ©2014 Leehon ºÚ°×Òº¾§ÆÁ:www.lcdlh.com
ÕãICP±¸09088427ºÅ-2 ¿Í·þµç»°£º0571-86684288 ÒµÎñºÏ×÷QQ£º3518470298