You are on page 1of 2

unsigned int res_adc;

void main() {

osccon = 0x7f;

adcon1 = 0x0A;

trisb = 0;

trisd = 0xfc;

TRISE = 0X03;

while(1){

switch(PORTE & 0x03){

case 0:

res_adc = adc_read(0);

portb = ADRESL;

portd = ADRESH;

break;

case 1:

res_adc = adc_read(1);

portb = ADRESL;

portd = ADRESH;

break;

case 2:

res_adc = adc_read(2);

portb = ADRESL;

portd = ADRESH;

break;

default:

res_adc = adc_read(3);
portb = ADRESL;

portd = ADRESH;

break;

You might also like