您当前的位置:五五电子网电子知识单片机-工控设备PIC单片机pic16f877a c语言时钟程序 正文
pic16f877a c语言时钟程序

pic16f877a c语言时钟程序

点击数:7778 次   录入时间:03-04 11:51:34   整理:http://www.55dianzi.com   PIC单片机
            //lcd_write_inst(time_start_addr);
            adjust_item ++;
        }
        else if (KeyNew == key_left)
        {
            adjust_item = 7;
            lcd_write_inst(time_start_addr + 9);
        }
        else if(KeyNew == key_right)
        {
            adjust_item ++;
            lcd_write_inst(time_start_addr + 1);
        }
    }
    else if(adjust_item == 1)
    {
        if ((KeyNew >=0) & (KeyNew <= 9))
        {
            CurrentDate.year2 = KeyNew;
            lcd_write_data(CurrentDate.year2 + ’0’);
            //lcd_write_inst(time_start_addr + 1);
            adjust_item ++;
        }
        else if (KeyNew == key_left)
        {
            adjust_item --;
            lcd_write_inst(time_start_addr + 0);
        }
        else if(KeyNew == key_right)
        {
            adjust_item ++;
            lcd_write_inst(time_start_addr + 2);
        }
    }
    else if(adjust_item == 2)
    {
        if ((KeyNew >=0) & (KeyNew <= 9))
        {
            CurrentDate.year3 = KeyNew;
            lcd_write_data(CurrentDate.year3 + ’0’);
            //lcd_write_inst(time_start_addr + 2);
            adjust_item ++;
        }
        else if (KeyNew == key_left)
        {
            adjust_item --;
            lcd_write_inst(time_start_addr + 1);
        }
        else if(KeyNew == key_right)
        {
            adjust_item ++;
            lcd_write_inst(time_start_addr + 3);
        }
    }
    else if(adjust_item == 3)
    {
        if ((KeyNew >=0) & (KeyNew <= 9))
        {
            CurrentDate.year4 = KeyNew;
            lcd_write_data(CurrentDate.year4 + ’0’);
            //lcd_write_inst(time_start_addr + 3);
            adjust_item ++;
            lcd_write_inst(time_start_addr + 5);
        }
        else if (KeyNew == key_left)
        {
            adjust_item --;
            lcd_write_inst(time_start_addr + 2);
        }
        else if(KeyNew == key_right)
        {
            adjust_item ++;
            lcd_write_inst(time_start_addr + 5);
        }
    }
    else if(adjust_item == 4)
    {
        if (((CurrentDate.monthl>2) & (KeyNew == 0)) | ((CurrentDate.monthl == 0) & (KeyNew == 1))
            | (((CurrentDate.monthl == 1) | (CurrentDate.monthl == 2)) & (KeyNew <2)))
        {
            CurrentDate.monthh = KeyNew;
            lcd_write_data(CurrentDate.monthh + ’0’);
            //lcd_write_inst(time_start_addr + 5);
            adjust_item ++;
        }
        else if (KeyNew == key_left)
        {
            adjust_item --;
            lcd_write_inst(time_start_addr + 3);
        }

上一页  [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16] [17]  下一页


本文关键字:程序  C语言  PIC单片机单片机-工控设备 - PIC单片机