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.

Problem with a program for PIC18F that reads ADC signals

Status
Not open for further replies.

engineer123

Junior Member level 3
Joined
Apr 1, 2008
Messages
25
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,500
Hi everybody ;

My problem that i wrote program for pic18f to read adc signals , at the evluation board my program works fine , at the board that i built i'm getting 0 at the pc interface , i measured the analog signal at the pin and there is signal, by the way the pic is doing all the functions i checked if its communicating with the pc , and it does , but why i'm getting zero's i dont know , where the problem could be

any ideas please ????? i was trying to check that all day , but i couldnt find where i missed up , i thought that problem in the program but it works fine cuz i tested with the evulation board , i thought its for the hardware , i measured and there is signal ??????????????
 

why adc was damaged

You have not give us a lot to go
Like where are you trying to read it to LCD or sending it to PC a Diagram would help and try to explain a bit more what your trying to do.

With what you give us so far is like me asking you how long is this piece of string I hold in my hands :D Do you catch my drift :wink:
 

18f openadc

Hi,
It appears your ADC subsystem is not working. Check for the following , if applicable, directly at the pins of the micro:

1. Is ADC external reference in place?
2. Analog and Digital grounds are shorted?
3. Is ADC supply in place?
4. Any other ADC related pin connections loose?

Regards,
Laktronics
 

openadc pic

Hi;

exactly means the the adc not working , well i measured the voltage at the input pin and there is voltage Digital and analog ground is connected ,

but i'm not sure if i get you for the "Is ADC external reference in place" what do u mean ? what do u mean is ADC Supply in place??

thanks
 

adc_vrefplus_vdd

Hi,
Do not worry, if you do not know I suppose these are not applicable to your case. In some systems, there will be provision to apply external reference to ADC as well as to use a separate Analog supply ( different from Vcc ) for AD subsystem. While writing the reply I did not check up the data sheet to see if your system has got these features, that is why I added the phrase 'if applicable'.

So, now where is the problem? Since your proto board is working, the only thing you need to do is carefully checking all connections on your new board.

How about the polarity of the analog signal?

Regards,
Laktronics
 

problem reading an2 in pic18f1320

Hey ,

i have checked all the connection carefully and i assume everything oki ,

i found something strange :
for open adc :
OpenADC( ADC_FOSC_RC & ADC_LEFT_JUST & ADC_0_TAD,ADC_CH0 & ADC_INT_OFF,0 ); where no Ref configured , maybe here is the problem

but when i add the ref:

OpenADC( ADC_FOSC_32 & ADC_RIGHT_JUST & ADC_8ANA_0ref, ADC_CH0 & ADC_INT_OFF,0 ); the code would not compile why not ,

and if this cuz the problem why at the evaluation kit not cuzing the problem

and please how can i fix this problem
 

is adc needed

Can u upload ur circuit diagram so that we can see what u are doing exaclty.
 

what is adc_8ana_0ref

Hi,
Sorry, I misunderstood, I was imagining you were working with identical hardware, your hardawre difference could mean difference in performance.

OpenADC( ADC_FOSC_32 & ADC_RIGHT_JUST & ADC_8ANA_0ref, ADC_CH0 & ADC_INT_OFF,0 ); the code would not compile why not ,

Does the compiler give any errors?

Regards,
Laktronics
 

pic18f openadc()

Hi ,

yes the compiler give thats ADC_8ANA_0ref is not defined ???

but when i tried :

OpenADC(ADC_FOSC_RC & ADC_LEFT_JUST & ADC_12_TAD, ADC_CH0 & ADC_INT_OFF & ADC_VREFPLUS_VDD & ADC_VREFMINUS_VSS, 0b0110);

it compilied and my system works oki now ,
but it took me todays to find out that i need to use this :

ADC_VREFPLUS_VDD & ADC_VREFMINUS_VSS
it drive me crazy ,
how can i know the correct configuration , is there anyway at microchip manual that show this .

what is more strange that without this configuration the Evaluation board worked fine , just when trying to program new PIC out for the Evaluation board it wouldnt work with out this configuration whyyyy???????

thanks for the help
 

adc_int_off

Hi,
Yes, that chip has got provision to apply Vdd/Vss as Vref+/- or an external Ref applied across two analog channels (AN2/AN3?). It is specified in the data sheet.

Your C manual should describe under OpenADC() function what parameters it expects.

Is it possible that the configuration memory in the original PIC protected, you may find it under programming details.

Regards,
Laktronics
 

Re: Need Help for ADC

in some 18F Series like PIC18F452 you need to configure ADC pin as an analog Pin and make its TRIS bit an Input

Check This, another issue your ADC Sampler / OSC may not be working

Once I had to work with a MCU unit whose ADC was damaged rest of Controller works fine
check this too
Best of Luck
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top