sprintf(szVal, "%0.3f" , val); LCD_DisString((i%9)+1, 19, szVal); Pro_szUnit(DBData[i],i); if (isDraw == 1) val = LCD_BitModify(val,draw); ikey = Lcd_Recvfun2(); switch(ikey) { case LCD_KEY_UP: bit = 0; if (not == 2) { if (draw > page + 1 && draw <= line) draw = draw - 1; } break; case LCD_KEY_DOWN: bit = 0; if (not == 2) { if(draw < i) if (draw < line) draw = draw + 1; } break; case LCD_KEY_ADD: break; case LCD_KEY_DECREASE: break; case LCD_KEY_Left: if (not == 1) { change = 0; if(page < 9) continue; if(page >= 9) { page = page - 9; line = line - 9; } } break; case LCD_KEY_RIGHT: if (not == 1) { change = 0; if(line >= num) continue; if(page < num) { page = page + 9; line = line + 9; } } break; case LCD_KEY_ENTER: not = 2; bit = 0; break; case LCD_KEY_CANCEL: change = 0; if(not > 0) --not; draw = 0; if (not == 0) return; break; default: break; } } 这段代码中的LCD_BitModify函数也会运行ikey = Lcd_Recvfun2(); switch(ikey) { case LCD_KEY_UP: bit = 0; if (not == 2) { if (draw > page + 1 && draw <= line) draw = draw - 1; } break; case LCD_KEY_DOWN: bit = 0; if (not == 2) { if(draw < i) if (draw < line) draw = draw + 1; } break; case LCD_KEY_ADD: break; case LCD_KEY_DECREASE: break; case LCD_KEY_Left: if (not == 1) { change = 0; if(page < 9) continue; if(page >= 9) { page = page - 9; line = line - 9; } } break; case LCD_KEY_RIGHT: if (not == 1) { change = 0; if(line >= num) continue; if(page < num) { page = page + 9; line = line + 9; } } break; case LCD_KEY_ENTER: not = 2; bit = 0; break; case LCD_KEY_CANCEL: change = 0; if(not > 0) --not; draw = 0; if (not == 0) return; break; default:break; }怎么使它们互不干扰
时间: 2024-04-05 07:32:16 浏览: 110
ADC0832-single.rar_adc0832_adc0832 lcd1602_single_sprintf
要使LCD_BitModify函数和ikey = Lcd_Recvfun2() switch语句互不干扰,您可以在处理完LCD_BitModify函数后,再执行ikey的操作。例如,可以将LCD_BitModify函数的返回值存储到一个变量中,然后在switch语句执行之前先根据变量的值决定是否需要执行switch语句。另外,建议您在编写代码时,将不同的功能模块封装成不同的函数,以便更好地管理和维护代码。
阅读全文