Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[PIC] PIC16F876A strange ADC output value

Status
Not open for further replies.

ginettine

Newbie level 5
Newbie level 5
Joined
Mar 29, 2022
Messages
9
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
87
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:

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
 

Unless you are extremely careful, you will always get noise on the signal.
My 'rule of thumb' is that you only really get 8 bits directly out of a 10 (or even 12) bit ADC and you might get another bit (or 2) with careful programming (averaging etc.)
Therefore having the LSB (or 2) moving randomly is to be expected.
Susan
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top