>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; > } I don't know how much better the generated code for the following would be, but at least the C code is more compact: unsigned char PORTB_temp; PORTB_temp=0; PORTB_temp|=ADRESH>0; PORTB_temp|=(ADRESH>=31) << 1; PORTB_temp|=(ADRESH>=62) << 2; PORTB_temp|=(ADRESH>=93) << 3; PORTB_temp|=(ADRESH>=124) << 4; PORTB_temp|=(ADRESH>=155) << 5; PORTB_temp|=(ADRESH>=186) << 6; PORTB_temp|=(ADRESH>=217) << 7; PORTB = PORTB_temp; __________________________________________________ Do you Yahoo!? Yahoo! Web Hosting - establish your business online http://webhosting.yahoo.com -- http://www.piclist.com#nomail Going offline? Don't AutoReply us! email listserv@mitvma.mit.edu with SET PICList DIGEST in the body