您当前的位置:五五电子网电子知识单片机-工控设备AVR单片机icc avr LCD1602显示屏程序 正文
icc avr LCD1602显示屏程序

icc avr LCD1602显示屏程序

点击数:7259 次   录入时间:03-04 12:03:21   整理:http://www.55dianzi.com   AVR单片机
void LCD1602_putd0(uint8 endAdr,uint32 dat,uint8 length)
{
    sint8 i;
    speaData(dat,length);
    //LCD1602_setCmd("AC++");
    write(0,endAdr-length+1);
    for(i=length-1;i>=0;i--)
        write(1,dataElem[i]+0x30);
}
/*--------------------------------------------------------------------
函数名称:输出一个数值(不带0)
函数功能:
注意事项:无
提示说明:调用LCD1602_putd(0x8F,123,5),则从0x8B开始到0X8F输出"  123"
输    入:
返    回:无
--------------------------------------------------------------------*/
void LCD1602_putd(uint8 endAdr,uint32 dat,uint8 length)
{
    sint8 i;
    sint8 effectLen;
    if(dat>999999)
         effectLen=7;
    else if(dat>99999)
         effectLen=6;
    else if(dat>9999)
         effectLen=5;
    else if(dat>999)
         effectLen=4;
    else if(dat>99)
         effectLen=3;
    else if(dat>9)
         effectLen=2;
    else
         effectLen=1;
    speaData(dat,effectLen);
    //LCD1602_setCmd("AC++");
    if(length>effectLen)
    {
        write(0,endAdr-length+1);
        for(i=length-effectLen-1;i>=0;i--)
            write(1,’ ’);
    }
    for(i=effectLen-1;i>=0;i--)
    {
        if(i==0||dataElem[i])
        {
            write(0,endAdr-i);
            for(;i>=0;i--)
                write(1,dataElem[i]+0x30);
        }
    }
}
/*--------------------------------------------------------------------
函数名称:输出一个混合串
函数功能:
注意事项:最好不要加载这个函数,因为它将占用将近1K空间
提示说明:调用LCD1602_sprintf(0x8F,12AB,4),则从0x8B开始到0X8F输出"12ABok"
输    入:
返    回:无
--------------------------------------------------------------------*/
//void LCD1602_sprintf(uint8 startAdr,uint32 dat,uint8 length)
//{
//    /* clear the display area first here! */
//    //LCD1602_puts(addr,"      ");
//    sprintf(t,"%luok",dat);
//    //LCD1602_setCmd("AC++");
//    LCD1602_puts(addr,t);
//}

#endif





上一页  [1] [2] [3] [4] [5] 


本文关键字:程序  显示屏  AVR单片机单片机-工控设备 - AVR单片机