zulkifliaziz
Junior Member level 1
Hi all,
I have problem understand the this.
I'm using pic18f452, The idea is that i want to multiply or divide some value.
let says that , i read adc value from an0 using ADC_Read(0)>>2,
off course, the adc value in digital is from 0-255 rite?
Below is my code
so basically, if the code and my understanding is correct, if the value read by the adc(0) is max which is 255, does it mean when it being divided by 2, the output should be 128 or something.. but what i got i far more than 128. i do not understand. can anyone please help. thanks
I have problem understand the this.
I'm using pic18f452, The idea is that i want to multiply or divide some value.
let says that , i read adc value from an0 using ADC_Read(0)>>2,
off course, the adc value in digital is from 0-255 rite?
Below is my code
temp_res = ADC_Read(0) >> 2;
delay_ms(100);
if (temp_res>0)
{
temp_res = temp_res/2; //divide by 2
UART1_Write(temp_res);
....
....
}
so basically, if the code and my understanding is correct, if the value read by the adc(0) is max which is 255, does it mean when it being divided by 2, the output should be 128 or something.. but what i got i far more than 128. i do not understand. can anyone please help. thanks