lcd_write_inst(time_secondl_addr);
}
else if(KeyNew == key_right)
{
adjust_item = 0;
lcd_write_inst(time_hourh_addr);
}
}
}
// -------------------------------------------------------
void set_alarm2(void)
{
if (adjust_item == 0) // set hourh
{
if (((AlarmTime2.hourl <4) & (KeyNew < 3)) | ((AlarmTime2.hourl >3) & (KeyNew <2)))
{
AlarmTime2.hourh = KeyNew;
lcd_write_data(AlarmTime2.hourh + ’0’); // refresh hourh
//lcd_write_inst(0x10); // MOV e cursor back
adjust_item ++;
}
else if(KeyNew == key_left)
{
adjust_item = 6;
lcd_write_inst(time_secondl_addr+3);
}
else if(KeyNew == key_right)
{
adjust_item ++;
lcd_write_inst(time_hourl_addr);
}
}
else if (adjust_item == 1) // set hourl
{
if (((AlarmTime2.hourh == 2) & (KeyNew < 4)) | ((AlarmTime2.hourh < 2) & (KeyNew <=9)))
{
AlarmTime2.hourl = KeyNew;
lcd_write_data(AlarmTime2.hourl + ’0’); // refresh hourl
//lcd_write_inst(0x10); // MOV e cursor back
adjust_item ++;
lcd_write_inst(time_minuteh_addr);
}
else if(KeyNew == key_left)
{
adjust_item --;
lcd_write_inst(time_hourh_addr);
}
else if(KeyNew == key_right)
{
adjust_item ++;
lcd_write_inst(time_minuteh_addr);
}
}
else if (adjust_item == 2) // set minuteh
{
if (KeyNew <6)
{
AlarmTime2.minuteh = KeyNew;
lcd_write_data(AlarmTime2.minuteh + ’0’);
//lcd_write_inst(0x10); // MOV e cursor back
adjust_item ++;
}
else if(KeyNew == key_left)
{
adjust_item --;
lcd_write_inst(time_hourl_addr);
}
else if(KeyNew == key_right)
{
adjust_item ++;
lcd_write_inst(time_minutel_addr);
}
}
else if (adjust_item == 3) // set minutel
{
if ((KeyNew >=0) & (KeyNew <=9))
{
AlarmTime2.minutel = KeyNew;
lcd_write_data(AlarmTime2.minutel + ’0’);
//lcd_write_inst(0x10); // MOV e cursor back
adjust_item ++;
lcd_write_inst(time_secondh_addr);
}
else if(KeyNew == key_left)
{
adjust_item --;
lcd_write_inst(time_minuteh_addr);
上一页 [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16] [17] 下一页
本文关键字:程序 C语言 PIC单片机,单片机-工控设备 - PIC单片机