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.

[SOLVED] ADC Configuration for 16F877A

Status
Not open for further replies.

incomplete_jerin

Advanced Member level 2
Joined
Jun 4, 2010
Messages
549
Helped
97
Reputation
208
Reaction score
92
Trophy points
1,308
Location
INDIA
Activity points
3,912
Hi all.
I'm confused how to configure ADC for my application. I need two ADCs for my project. At channel-1 i need to measure the variation of a float sensor & at second channel i need to measure the variation of a thermal sensor. Can anyone suggest me a method to tackle this situation? I'm coding in HI-tech C & the PIC i'm using is PIC16F877A.

Thanking you,
Regards,
Jerin.
 

Hi,

16F877A has 10bit resolution ADC; if it is enough for your purpose, you can proceed.
You can connect up to 8 analog signals to be digitized; and process one at a moment.

Thank you,
 

Hi,

16F877A has 10bit resolution ADC; if it is enough for your purpose, you can proceed.
You can connect up to 8 analog signals to be digitized; and process one at a moment.

Thank you,

Thanx for your reply buddy. I know the things what you said above. My question is how can we implement this process with 2 different channels of ADC?

Thanking you,
Regards,
Jerin.
 

Hi,

You connect those 2 devices to 2 separate analog-input channels (select 2 from AN0...AN7 pins).

In your code set those 2 pins as analog-inputs and set other ADC configurations as you need.

Then in your code first select one channel by configuring CHS2:CHS0 bits in ADCON0 register; then do the conversion; backup results.

Then select 2nd channel by configuring CHS2:CHS0 bits again and follow above sequence.

For more info on configurations see "ANALOG-TO-DIGITAL CONVERTER (A/D) MODULE" in datasheet.

Is this what you asked ?
 
It is basically the same as you do with one ADC channel, instead you will be repeating the same piece of code with the corresponding channel selection bits. As dinesh said, remember to configure the desired analog channel each time before you sample the values.
 

Hi,

You connect those 2 devices to 2 separate analog-input channels (select 2 from AN0...AN7 pins).

In your code set those 2 pins as analog-inputs and set other ADC configurations as you need.

Then in your code first select one channel by configuring CHS2:CHS0 bits in ADCON0 register; then do the conversion; backup results.

Then select 2nd channel by configuring CHS2:CHS0 bits again and follow above sequence.

For more info on configurations see "ANALOG-TO-DIGITAL CONVERTER (A/D) MODULE" in datasheet.

Is this what you asked ?

Thanx dinesh. You are almost there. Let me try what you have just posted above. Thank you for your reply buddy. I'll post the resulting code in the forum.

Thanking you,
Regards.
Jerin.
 

Hi,
Just make sure in your code that if you are shifting one channel to another channel give some delay to get accurate analog value.

Regards
Chanchal Chauhan
 

Hi,
If you use HiTech, check in the compiler manual. They should have library functions to read off ADC with provision for selecting channels.

Hope this helps.
Tahmid.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top