英锐恩单片机论坛,Microchip单片机,模拟器件,接口电路,麦肯单片机,单片机应用交流

 找回密码
 立即注册
搜索
电子烟方案单片机单片机开发深圳单片机开发
单片机方案国产单片机8位单片机电子烟方案开发
查看: 3161|回复: 0

少见的PIC16F91x 控制LCD

[复制链接]
发表于 2009-3-7 23:41:23 | 显示全部楼层 |阅读模式
//= = = = = = =LCD TABLE = = = = = = = = =
  const unsigned char TABLE[11]={        //x G F E D C B A
                         0x3f,        //0
                         0x06,        //1
                         0x5d,        //2
                         0x4f,        //3
                         0x66,        //4
                         0x6b,        //5
                         0x7b,        //6
                         0x0e,        //7
                         0x7f,        //8
                         0x6f,        //9
                         0x40,        //o
};

void
LCDDisplay(unsigned int DisplayData){

        LCDDATA0        = 0;
        LCDDATA3        = 0;
        LCDDATA6        = 0;
        LCDDATA9        = 0;
                          
        if(((DisplayData >> 12 ) & 0x0f) == 1)
                  SEG0COM0 = 1;
          else
                  SEG0COM0 = 0;
        
          SEG5COM0        = (TABLE[DisplayData&0x0f]>>D) & 0x01;
          SEG4COM1        = (TABLE[DisplayData&0x0f]>>E) & 0x01;
          SEG5COM1        = (TABLE[DisplayData&0x0f]>>C) & 0x01;
          SEG5COM2        = (TABLE[DisplayData&0x0f]>>B) & 0x01;
          SEG4COM2        = (TABLE[DisplayData&0x0f]>>G) & 0x01;
          SEG5COM3        = (TABLE[DisplayData&0x0f]>>A) & 0x01;
          SEG4COM3        = (TABLE[DisplayData&0x0f]>>F) & 0x01;
                    
          SEG3COM0        = (TABLE[DisplayData>>4&0x0f]>>D) & 0x01;
          SEG2COM1        = (TABLE[DisplayData>>4&0x0f]>>E) & 0x01;
          SEG3COM1        = (TABLE[DisplayData>>4&0x0f]>>C) & 0x01;
          SEG3COM2        = (TABLE[DisplayData>>4&0x0f]>>B) & 0x01;
          SEG2COM2        = (TABLE[DisplayData>>4&0x0f]>>G) & 0x01;
          SEG3COM3        = (TABLE[DisplayData>>4&0x0f]>>A) & 0x01;
          SEG2COM3        = (TABLE[DisplayData>>4&0x0f]>>F) & 0x01;

          SEG1COM0        = (TABLE[DisplayData>>8&0x0f]>>D) & 0x01;
          SEG0COM1        = (TABLE[DisplayData>>8&0x0f]>>E) & 0x01;
          SEG1COM1        = (TABLE[DisplayData>>8&0x0f]>>C) & 0x01;
          SEG1COM2        = (TABLE[DisplayData>>8&0x0f]>>B) & 0x01;
          SEG0COM2        = (TABLE[DisplayData>>8&0x0f]>>G) & 0x01;
          SEG1COM3        = (TABLE[DisplayData>>8&0x0f]>>A) & 0x01;
          SEG0COM3        = (TABLE[DisplayData>>8&0x0f]>>F) & 0x01;

        SEG4COM0        = 1;
}
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关闭

站长推荐上一条 /1 下一条

小黑屋|公司首页|Microchip单片机,模拟器件,接口电路,麦肯单片机,单片机应用交流 ( 粤ICP备09008620号 )

GMT+8, 2024-3-29 04:10 , Processed in 0.083363 second(s), 23 queries .

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表