Hi to all engineers, I am working on C code for test using 18f252 I need to convert ADRESH to bar graph style led movement. This code works fine on demo board but I think there is Shorter method any idea will appreciate. if (ADRESH==0) { PORTB=0b00000000; } if ((ADRESH>0)&&(ADRESH<=30)) { PORTB|=0b00000001; } if ((ADRESH>=31)&&(ADRESH<=61)) { PORTB|=0b00000011; } if ((ADRESH>=62)&&(ADRESH<=92)) { PORTB|=0b00000111; } if ((ADRESH>=93)&&(ADRESH<=123)) { PORTB=0b00001111; } if ((ADRESH>=124)&&(ADRESH<=154)) { PORTB|=0b00011111; } if ((ADRESH>=155)&&(ADRESH<=185)) { PORTB|=0b00111111; } if ((ADRESH>=186)&&(ADRESH<=216)) { PORTB|=0b01111111; } if ((ADRESH>=217)&&(ADRESH<=255)) { PORTB|=0b111111111; } Andre -- http://www.piclist.com#nomail Going offline? Don't AutoReply us! email listserv@mitvma.mit.edu with SET PICList DIGEST in the body