CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

I got a question about PIC 16F877 set up analog to digital.

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Brian
Guest







I got a question about PIC 16F877 set up analog to digital.
PostPosted: Fri Mar 27, 2009 4:06 pm     Reply with quote

Hello everyone,

I got a question about setup_adc_ports.

In the PIC 16F877, the port A and E are analog. I just need to set it up on PIN A0_A1_A2. and PIN E0_E1.

I used the command " setup_adc_ports(A0_A1_A2_ANALOG);"
and "setup_adc_ports(E0_E1_ANALOG);"

but it showed that "Undefined identifier A0_A1_A2_ANALOG"
and "Undefined identifier RE0_RE1_ANALOG"

I do not know what's wrong.

Any help will be appreciated.

Thank you very much.



Sincerely,



Brian
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Mar 27, 2009 4:15 pm     Reply with quote

Look in your 16F877.h file. It has the list of constants that may be used
with setup_adc_ports() function. Here is the file location:
Quote:
c:\program files\picc\devices\16f877.h
Brian
Guest







I got a question about PIC 16F877 set up analog to digital.
PostPosted: Fri Mar 27, 2009 11:42 pm     Reply with quote

Hello PCM programmer,

I have already taken a look the pic16f877.h. I just need A0_A1_A2 and E0_E1 but it does not have this choice.
What is the mean "A0 A1 A5 E0 VRefh=A3 VRefl=A2"? I have no idea what reference means. What is the purpose?

Thank you so much.
Sincerely,
Brian
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Mar 27, 2009 11:52 pm     Reply with quote

Quote:

I have already taken a look the pic16f877.h. I just need A0_A1_A2 and '
E0_E1 but it does not have this choice.

The choices given in 16F877.h are the only ones available.
To satisfy your requirements, you will have to upgrade to a 16F887.
This is a more advanced chip. It allows individual selection of Analog
or Digital mode on all analog pins.

Quote:

What is the mean "A0 A1 A5 E0 VRefh=A3 VRefl=A2"? I have no idea what reference means. What is the purpose?

Read the 16F877 data sheet, in the ADC section. External Vref is used
if you want reference voltages instead of the normal Vdd (+5v) and
ground. Normally you don't need to do this.
Brian
Guest







I got a question about PIC 16F877 set up analog to digital.
PostPosted: Sat Mar 28, 2009 12:06 am     Reply with quote

Hello PCM programmer,

Thank you for your reply.
I understood now.
Thank you so much,

Sincerely,

Brian
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sat Mar 28, 2009 12:18 am     Reply with quote

If you are in the US or nearby, you can get the 16F887 (in DIP-40
package) for $2.64 + shipping from http://www.mouser.com
There is no minimum order. Part number: 579-PIC16F887-I/P

Or, possibly you can order a free sample from Microchip, but it might
not ship immediately.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group