ginettine
Newbie level 5
Hi, I'm Alex from Italy.
Sorry for the bad English.
I'm trying to verify what is the input voltage level on AN0 that sets the LSB to 1 (in theory 5/1024 = 4.88mV!).
On breadboard I stabilized Vdd = 5V with lm317.
I send the converted value to 10bits on portb (8 least significant bits!), And on RC0 and RC1 the two bits MSB
Problems:
1) The Vin level that sets the LSB (RB0!) to 1 is "variable" (almost a linear ramp between about 1.8 and 5V!) Between about 6 and 8mV.
2) with an oscilloscope I see a sort of "PWM" output on RB0 with variable duty cycle, when the Vin varies between about 6 and 8mV !!!!
How is it possible?
The code in Mikroc:
Many thanks!
Alex
Sorry for the bad English.
I'm trying to verify what is the input voltage level on AN0 that sets the LSB to 1 (in theory 5/1024 = 4.88mV!).
On breadboard I stabilized Vdd = 5V with lm317.
I send the converted value to 10bits on portb (8 least significant bits!), And on RC0 and RC1 the two bits MSB
Problems:
1) The Vin level that sets the LSB (RB0!) to 1 is "variable" (almost a linear ramp between about 1.8 and 5V!) Between about 6 and 8mV.
2) with an oscilloscope I see a sort of "PWM" output on RB0 with variable duty cycle, when the Vin varies between about 6 and 8mV !!!!
How is it possible?
The code in Mikroc:
Code:
unsigned int temp_res;
void main ()
{
ADCON1 = 0x80; //
PORTB = 0;
PORTC = 0;
TRISB = 0;
TRISC = 0;
TRISA.F0 = 1;
do {
temp_res = ADC_Read (0); //
PORTB = temp_res; //
PORTC = temp_res >> 8; //
} while (1);
}
Many thanks!
Alex