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

pic16f877a c语言时钟程序

点击数:7778 次   录入时间:03-04 11:51:34   整理:http://www.55dianzi.com   PIC单片机
        lcd_write_data(AlarmTime1.secondl + ’0’);
        lcd_write_data(’ ’);
        lcd_write_data(’O’);
        if (Alarm1Enable)
        {
            lcd_write_data(’n’);
        }
        else
        {
            lcd_write_data(’f’);
            lcd_write_data(’f’);
        }
        pStr = StrAlarm1;
        Alarm1Cnt =0;
    }
    else if(CurrentMode == mode_set_alarm2)
    {
        lcd_write_data(AlarmTime2.hourh + ’0’);
        lcd_write_data(AlarmTime2.hourl + ’0’);
        lcd_write_data(’:’);
        lcd_write_data(AlarmTime2.minuteh + ’0’);
        lcd_write_data(AlarmTime2.minutel + ’0’);
        lcd_write_data(’:’);
        lcd_write_data(AlarmTime2.secondh + ’0’);
        lcd_write_data(AlarmTime2.secondl + ’0’);
        lcd_write_data(’ ’);
        lcd_write_data(’O’);
        if (Alarm2Enable)
        {
            lcd_write_data(’n’);
        }
        else
        {
            lcd_write_data(’f’);
            lcd_write_data(’f’);
        }
        pStr = StrAlarm2;
        Alarm2Cnt = 0;
    }
    lcd_write_inst(0xc0);    //    set LCD line2
    if (CurrentMode != mode_time)
    {
        for (;*pStr!=0;pStr++)
        {                        //    write hint message
            lcd_write_data(*pStr);
        }
        lcd_write_inst(0x0f);    //    LCD cursor on
        lcd_write_inst(time_start_addr);    //     MOV e cursor to start
    }
    else    //    time mode,write date to second line
    {
        lcd_write_inst(0x0c);        //    LCD sursor off
 /*        lcd_write_inst(0xc0 + 3);    //    set date start address
        lcd_write_data(CurrentDate.year1 + ’0’);
        lcd_write_data(CurrentDate.year2 + ’0’);
        lcd_write_data(CurrentDate.year3 + ’0’);
        lcd_write_data(CurrentDate.year4 + ’0’);
        lcd_write_data(’/’);
        lcd_write_data(CurrentDate.monthh + ’0’);
        lcd_write_data(CurrentDate.monthl + ’0’);
        lcd_write_data(’/’);
        lcd_write_data(CurrentDate.dayh + ’0’);
        lcd_write_data(CurrentDate.dayl + ’0’);
 */  }
    if (CurrentMode == mode_set_time)
    {
        lcd_write_inst(time_start_addr);    //     MOV e cursor to start
    }
    else if (CurrentMode == mode_set_date)
    {
        lcd_write_inst(time_start_addr);    //     MOV e cursor to start
    }
    else if (CurrentMode == mode_set_alarm1)
    {
        lcd_write_inst(time_secondl_addr+3);
        adjust_item = 6;
    }
    else if (CurrentMode == mode_set_alarm2)
    {
        lcd_write_inst(time_secondl_addr+3);
        adjust_item = 6;
    }
    else
    {
        lcd_write_inst(0x0c);    //    LCD cursor off
    }
 }


 //    -------------------------------------------------------
 void set_date(void)
 {
    if (adjust_item == 0)    //    adjust year
    {
        if ((KeyNew >=0) & (KeyNew <= 9))
        {
            CurrentDate.year1 = KeyNew;
            lcd_write_data(CurrentDate.year1 + ’0’);

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


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