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))
{
CurrentTime.minutel = KeyNew;
lcd_write_data(CurrentTime.minutel + '0');
//lcd_write_inst(0x10); // move cursor back
adjust_item ++;
lcd_write_inst(time_secondh_addr);
}
else if(KeyNew == key_left)
{
adjust_item --;
lcd_write_inst(time_minuteh_addr);
}
else if(KeyNew == key_right)
{
adjust_item ++;
lcd_write_inst(time_secondh_addr);
}
}
else if (adjust_item == 4) // set secondh
{
if (KeyNew <6)
{
CurrentTime.secondh = KeyNew;
lcd_write_data(CurrentTime.secondh + '0');
//lcd_write_inst(0x10); // move cursor back
adjust_item ++;
}
else if(KeyNew == key_left)
{
adjust_item --;
&nb, sp; lcd_write_inst(time_minutel_addr);
}
else if(KeyNew == key_right)
{
adjust_item ++;
lcd_write_inst(time_secondl_addr);
}
}
else if (adjust_item == 5) // set secondl
{
if ((KeyNew >=0) & (KeyNew <=9))
{
CurrentTime.secondl = KeyNew;
lcd_write_data(CurrentTime.secondl + '0');
//lcd_write_inst(0x10); // move cursor back
adjust_item = 0;
lcd_write_inst(time_hourh_addr);
}
else if(KeyNew == key_left)
{
adjust_item --;
lcd_write_inst(time_secondh_addr);
}
else if(KeyNew == key_right)
{
adjust_item = 0;
lcd_write_inst(time_hourh_addr);
}
}
}
// -------------------------------------------------------
void set_alarm1(void)
{
if (adjust_item == 0) // set hourh
{
if (((AlarmTime1.hourl <4) & (KeyNew < 3)) | ((AlarmTime1.hourl >3) & (KeyNew <2)))
{
AlarmTime1.hourh = KeyNew;
lcd_write_data(AlarmTime1.hourh + '0'); // refresh hourh
//lcd_write_inst(0x10); // move 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 (((AlarmTime1.hourh == 2) & (KeyNew < 4)) | ((AlarmTime1.hourh < 2) & (KeyNew <=9)))
{
AlarmTime1.hourl = KeyNew;
lcd_write_data(AlarmTime1.hourl + '0'); // refresh hourl
//lcd_write_inst(0x10); // move 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)
上一页 [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] 下一页
本文关键字:程序 C语言 PIC单片机,单片机-工控设备 - PIC单片机