View previous topic :: View next topic |
Author |
Message |
Brian Guest
|
I got a question about PIC 16F877 set up analog to digital. |
Posted: Fri Mar 27, 2009 4:06 pm |
|
|
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 |
|
![](templates/subSilver/images/spacer.gif) |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Fri Mar 27, 2009 4:15 pm |
|
|
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 |
|
|
![](templates/subSilver/images/spacer.gif) |
Brian Guest
|
I got a question about PIC 16F877 set up analog to digital. |
Posted: Fri Mar 27, 2009 11:42 pm |
|
|
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 |
|
![](templates/subSilver/images/spacer.gif) |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Fri Mar 27, 2009 11:52 pm |
|
|
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. |
|
![](templates/subSilver/images/spacer.gif) |
Brian Guest
|
I got a question about PIC 16F877 set up analog to digital. |
Posted: Sat Mar 28, 2009 12:06 am |
|
|
Hello PCM programmer,
Thank you for your reply.
I understood now.
Thank you so much,
Sincerely,
Brian |
|
![](templates/subSilver/images/spacer.gif) |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Sat Mar 28, 2009 12:18 am |
|
|
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. |
|
![](templates/subSilver/images/spacer.gif) |
|