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.

reasonable value of potentiometer for adc in pic

Status
Not open for further replies.

zish wish

Newbie level 3
Joined
Apr 22, 2014
Messages
4
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Location
Pakistan
Activity points
33
Hi,
what is the most reasonable value of potentiometer for getting adc value in pic18f2431?
 

hello,

i can propose :
1K , 2,2K or 4,7K
internal resistance of voltage source must be as low as possible
... ideal source of voltage generator is 0 ohms !
 
thanx paulfjujo, one more thing, there is also an issue that my adc is not ending its conversion in debugging i.e. ADCON0.GO doesn't clear after it has been set. I am using a loop which waits until ADCON0.GO is cleared. In some compilers it works well. Also, there is no output appearing in real hardware, can you diagnose the problem?

ADC_Acquisition
bsf ADCON0, 1 ; Start ADC Conversion
WAIT ; Wait for A/D conversion

btfsc ADCON0, 1
goto WAIT
call Update_Val
continued..............

i am initializing/configuring adc control registers in following way to get the data from AN4, single channel,8 MHz internal clock,



movlw 0x10
movwf ANSEL0
movlw 0x10 RA<3:0> as outputs
movwf TRISA

ADCON0=00000000 (later on ADCON.ADON is set)
ADCON1=00001000
ADCON2=00000011
ADCON3=0xC0

bcf ADCHS, GASEL1
bsf ADCHS, GASEL0
 
Last edited:

hello,

there is no output appearing in real hardware
???
How do you test and see ADC result ?

This PIC has some special features like a FIFO on ADC
Code:
ADCON1=00001000
this bit (BFEMT) is read only, and FIFOEN=0 so disabled
Code:
ADCON2=00000011
left justified ? No delay ? FRC/4 ?
try with
Code:
ADCON2=1 0110 101
Right justified, 12 TAD delay , FOSC/16
Code:
ADC_Acquisition
bsf     ADCON0, 1 ; Start ADC Conversion
[B][COLOR=#FF0000]NOP;[/COLOR][/B]    // minimum delay between change bit and test bit
WAIT ; Wait for A/D conversion
btfsc ADCON0, 1
goto WAIT
call Update_Val
continued..............
 

i am checking it by making port c output for ADC value. the data on port c (of adc value) is random and inconsistent with the potentiometer value (only one or two values appear for whole range of variation in potentiometer). i am making use of 8 bits of adc so left justified, i am attaching code with thread. plz review and tell me what should be the value in adc configuration/control registers for a simple single channel <AN4>, internally clocked adc. the code is working fine in proteus. proteus file is also attached.

View attachment no_int.zip
 
Last edited:

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top