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

pic16f877a c语言时钟程序

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

 //    -------------------------------------------------------
 void set_time(void)
 {
    if (adjust_item == 0)    //    set hourh
    {
        if (((CurrentTime.hourl <4) & (KeyNew < 3)) | ((CurrentTime.hourl >3) & (KeyNew <2)))
        {
            CurrentTime.hourh = KeyNew;
            lcd_write_data(CurrentTime.hourh + ’0’);    //    refresh hourh
            //lcd_write_inst(0x10);    //     MOV e cursor back
            adjust_item ++;
        }
        else if(KeyNew == key_left)
        {
            adjust_item = 5;
            lcd_write_inst(time_secondl_addr);

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


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