¶ÎÂëʽLCDÒº¾§ÆÁÄ»Çý¶¯·½·¨
·¢²¼Ê±¼ä£º16-07-05
ƽ³£ÔÚÉú»îÖмûµ½×î¶àµÄ¾ÍÊǶÎÂëÊÇÒº¾§ÆÁÄ»ÁË£¬ËüÓÐÆÕͨµÄÊýÂë¹ÜµÄÌØÕ÷£¬ÓÖÓеãÕóLCDµÄÌØÕ÷£¬¹Ì¶¨µÄͼÐΣ¬Ê¡³É±¾¶øÓкÿ´£¬ÄÇô£¬ÎÒÃǽñÌìÀ´·ÖÏíһ϶ÎÂëʽLCDµÄÏà¹Ø֪ʶ£¡
Ê×ÏÈ£¬´ó¼Ò²»ÒªÒÔΪÓõ¥Æ¬»úÀ´Çý¶¯¾ÍÒÔΪ¶ÏÂëÆÁÊÇÖ±Á÷Çý¶¯µÄ£¬Æäʵ£¬¶ÎÂëÆÁÊǽ»Á÷Çý¶¯£¬Ê²Ã´Êǽ»Á÷£¿¾ØÐ⨣¬ÕýÏÒ²¨µÈ¡£´ó¼Ò¿ÉÄܻᾳ£ÓÃÇý¶¯Ð¾Æ¬À´Í棬Àý
ÈçHT1621µÈ£¬µ«ÊÇÓÐЩ¶ÎʽÆÁIO¿Ú±È½ÏÉÙ£¬»òÕß˵IO¿Ú³ä×ãµÄÇé¿öÏ£¬Ò²ÀÁµÃÔÚȥд¿ØÖÆÆ÷µÄÇý¶¯ÁË¡£µ«ÊÇ£¬IOÄ£ÄâÇý¶¯¶ÎʽҺ¾§ÓÐÒ»¸öÇ°ÌáÌõ¼þ£¬¾ÍÊÇIO±ØÐëÊÇÈý̬£¬
Ϊʲô£¿ÏÂÃæÎÒÃÇÒ»ÆðϸϸµÀÀ´£º
µÚÒ»²½£¬¶ÎÂëʽҺ¾§ÆÁµÄÖØÒª²ÎÊý£º¹¤×÷µçѹ£¬ Õ¼¿Õ±È£¬ ƫѹ±È¡£ÕâÈý¸ö²ÎÊý·Ç³£ÖØÒª£¬±ØÐ붼ҪÂú×ã¡£
µÚ¶þ²½£¬Çý¶¯·½Ê½£º¸ù¾Ý LCD µÄÇý¶¯ÔÀí¿ÉÖª£¬LCD ÏñËصãÉÏÖ»ÄܼÓÉÏ AC µçѹ£¬LCD ÏÔʾÆ÷µÄ¶Ô±È¶ÈÓÉ COM½ÅÉϵĵçѹֵ¼õÈ¥ SEG ½ÅÉϵĵçѹֵ¾ö¶¨£¬µ±Õâ¸öµçѹ
²î´óÓÚ LCD µÄ±¥ºÍµçѹ¾ÍÄÜ´ò¿ªÏñËص㣬СÓÚ LCD ãÐÖµµçѹ¾ÍÄܹرÕÏñËص㣬LCD ÐÍ MCU ÒѾÓÉÄÚ½¨µÄ LCD Çý¶¯µç·×Ô¶¯²úÉú LCD Çý¶¯Ðźţ¬Òò´ËÖ»Òª I/O ¿ÚÄÜ·ÂÕæÊä
³ö¸ÃÇý¶¯Ðźţ¬¾ÍÄÜÍê³É LCD µÄÇý¶¯¡£
¶ÎÂëʽҺ¾§ÆÁÄ»Ö÷ÒªÓÐÁ½ÖÖÒý½Å£¬COM£¬SEG£¬¸úÊýÂë¹ÜºÜÏñ£¬µ«ÊÇ£¬Ñ¹²î±ØÐëÊǽ»Ìæ±ä»¯£¬ÀýÈçµÚһʱ¿ÌÊÇÕýÏòµÄ3V£¬ÄÇôµÚ¶þʱ¿Ì±ØÐëÊÇ·´ÏòµÄ3V£¬×¢ÒâÒ»µã£¬Èç¹û
¸ø¶ÎÂëʽҺ¾§ÆÁֱͨÁ÷µç£¬²»Óöà¾ÃÆÁÄ»¾Í»á·ÏÁË£¬ËùÒÔǧÍò×¢Òâ¡£ÏÂÃæÎÒÃÇÀ´¿¼ÂÇÈçºÎÄ£ÄâCOM¿ÚµÄ²¨ÐΣ¬ÒÔ1/4D£¬1/2BΪÀý×Ó£º
void display_sub(u8 y) //lcd display subroutine
{
switch(y) //4*com,VDD and -VDD LCD display,so 8 timebase interrupt one sacn period
{
case 1:
{com1_output_high();break;}
case 2:
{com1_output_low();break;}
case 3:
{com2_output_high();break;}
case 4:
{com2_output_low();break;}
case 5:
{com3_output_high();break;}
case 6:
{com3_output_low();break;}
case 7:
{com4_output_high();break;}
case 8:
{com4_output_low();break;}
default:
{LCDPluseStep=0;
get_display_code(AD_Value,KeyScanRetVal);
break;}
}
}
ÒÔÉÏ´úÂëËùʾ£¬¶¨Ê±2ms£¬ÈÃ4¸öCOM½»ÌæÊä³ö²¨Ðμ´¿É¡£
ͬʱÎÒÃÇҪעÒ⣬ÔÚCOMÊä³ö¸ßµÄʱºò£¬Èç¹ûÒªÆÁÄ»ÁÁ£¬SEG¾ÍÒªÊä³öµÍ£¬ÄÇôÔÚCOMÊä³öµÍµÄʱºò£¬SEG¾ÍÒªÊä³ö¸ß£¬±£Ö¤COMºÍSEGµÄѹ²î´óÓÚ1/2B¹¤×÷µçѹ¾Í¿ÉÒÔÏÔʾÁË
ÏÂÃæÎÒÃÇ¿´ÆäÖÐÒ»¸öcom¿ÚÊä³öʱµÄº¯Êý
static void seg1_output(void) //seg1 output subroutine
{
if(1 == (LCDPluseStep%2)) //com_pulse is odd,com output high (VDD)
{
if(0 == (DisplayCode1&0x10))
{SEG1=1;}
else
{SEG1=0;}
}
else //com_pulse is even,com output low (VSS)
{
if(0 == (DisplayCode1&0x10))
{SEG1=0;}
else
{SEG1=1;}
}
}
ʱ¿ÌÈÃSEGµçƽ¸úCOMµÄµçƽ·´Ïò£¬ÄÇôÇý¶¯¶ÎʽҺ¾§¾Í²»»áÓжà´óÄѶÈÁË