unsigned int adc_val;
void main() {
TRISA = 0;
TRISB = 0;
PORTB = 0;
do {
if (adc_val >= 0 && adc_val <= 18) {
PORTB = 0b00000000;
}
else if (adc_val > 18 && adc_val <= 36) {
PORTB = 0b00000100;
}
else if (adc_val > 36 && adc_val <= 67) {
PORTB = 0b00001100;
}
else if (adc_val > 67 && adc_val <= 87) {
PORTB = 0b00101100;
}
else if (adc_val > 87 && adc_val <= 118) {
PORTB = 0b00111100;
}
else if (adc_val > 118 && adc_val <= 138) {
PORTB = 0b01111100;
}
else if (adc_val > 138 && adc_val <= 169) {
PORTB = 0b01111110;
}
else if (adc_val > 169 && adc_val <= 189) {
PORTB = 0b11111110;
}
else if (adc_val > 189 && adc_val <= 220) {
PORTB = 0b11111111;
}
else {
PORTB = 0;
delay_ms(120);
PORTB = 0b11111111;
delay_ms(120);
}
}
while(1);
}