Knowledge Base
...
Applied PIC Micro Development
Sample Projects
Building the Bar Graph Display
2min
lead in the bar graph display takes the input from ad0 and converts the value to be displayed on 8 bits of a bar graph display code sample sample code for mikroc unsigned int16 adcread; char ledbar\[9]={0x00,0x01,0x03,0x07,0x0f,0x1f,0x3f,0x7f,0xff}; void setup(){ trisa = 0x01; trisd = 0x00; } void main(void){ setup(); while(1){ adcread=read adc(0); //wait for completion delay ms(50); adcread=(adcread 9)/256; //output the result to portd output d(ledbar\[adcread]); delay ms(50); } } lead out the code provided has been tested using a radix development board