Nah berikut saya share Program Menu setting ADC dapa LF atau sensor apa aja :
void peka_sensor()
{
unsigned char t;
unsigned char u;
while(1){
if(t==0){
lcd_clear();
u=read_adc(0);
lcd_gotoxy(0,0);
lcd_putsf("Set Sensor 0:");
lcd_gotoxy(0,1);
sprintf(buf, ">>%d Set:%d", u, peka[t]);
lcd_puts(buf);
if(sw1==0){
peka[t]=peka[t]+1;
}
if(sw0==0){
peka[t]=peka[t]-1;
}
}
else if(t==1){
lcd_clear();
u=read_adc(1);
lcd_gotoxy(0,0);
lcd_putsf("Set sensor 1:");
lcd_gotoxy(0,1);
sprintf(buf, ">>%d Set:%d", u, peka[t]);
lcd_puts(buf);
if(sw1==0){
peka[t]=peka[t]+1;
}
if(sw0==0){
peka[t]=peka[t]-1;
}
}
else if(t==2){
lcd_clear();
u=read_adc(2);
lcd_gotoxy(0,0);
lcd_putsf("Set sensor 2:");
lcd_gotoxy(0,1);
sprintf(buf, ">>%d Set:%d", u, peka[t]);
lcd_puts(buf);
if(sw1==0){
peka[t]=peka[t]+1;
}
if(sw0==0){
peka[t]=peka[t]-1;
}
}
else if(t==3){
lcd_clear();
u=read_adc(3);
lcd_gotoxy(0,0);
lcd_putsf("Set sensor 3:");
lcd_gotoxy(0,1);
sprintf(buf, ">>%d Set:%d", u, peka[t]);
lcd_puts(buf);
if(sw1==0){
peka[t]=peka[t]+1;
}
if(sw0==0){
peka[t]=peka[t]-1;
}
}
else if(t==4){
lcd_clear();
u=read_adc(4);
lcd_gotoxy(0,0);
lcd_putsf("Set sensor 4:");
lcd_gotoxy(0,1);
sprintf(buf, ">>%d Set:%d", u, peka[t]);
lcd_puts(buf);
if(sw1==0){
peka[t]=peka[t]+1;
}
if(sw0==0){
peka[t]=peka[t]-1;
}
}
else if(t==5){
lcd_clear();
u=read_adc(5);
lcd_gotoxy(0,0);
lcd_putsf("Set sensor 5:");
lcd_gotoxy(0,1);
sprintf(buf, ">>%d Set:%d", u, peka[t]);
lcd_puts(buf);
if(sw1==0){
peka[t]=peka[t]+1;
}
if(sw0==0){
peka[t]=peka[t]-1;
}
}
else if(t==6){
lcd_clear();
u=read_adc(6);
lcd_gotoxy(0,0);
lcd_putsf("Set sensor 6:");
lcd_gotoxy(0,1);
sprintf(buf, ">>%d Set:%d", u, peka[t]);
lcd_puts(buf);
if(sw1==0){
peka[t]=peka[t]+1;
}
if(sw0==0){
peka[t]=peka[t]-1;
}
}
else if(t==7){
lcd_clear();
u=read_adc(7);
lcd_gotoxy(0,0);
lcd_putsf("Set sensor 7:");
lcd_gotoxy(0,1);
sprintf(buf, ">>%d Set:%d", u, peka[t]);
lcd_puts(buf);
if(sw1==0){
peka[t]=peka[t]+1;
}
if(sw0==0){
peka[t]=peka[t]-1;
}
}
if(sw2==0) t=t+1;
if(t==8) t=0;
if (sw3==0){
for(count=0;count<8;count++){
Epeka[count]=peka[count]; //salin ke eeprom
}
break;
}
delay_ms(150);
} } ;
0 komentar:
Posting Komentar