View previous topic :: View next topic |
Author |
Message |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Tue Mar 27, 2007 12:51 pm |
|
|
Quote: |
If i use (for 16F877A) pin 2 as analogue input and pin 3,4,5 and 6
as input triggers will it be fine .. i mean it is allowed |
Look at the 16F877A.H file, near the end of the file, in the section called:
"Constants used in setup_adc_ports()".
That section lists all the available combinations of Analog and Digital pins.
Look on the right side in the comments, and it gives a list of all the pins
used and their purpose (for example, some pins are assigned to Vref
in some modes). |
|
|
Guest
|
|
Posted: Tue Mar 27, 2007 2:09 pm |
|
|
this section just gives the combination of analogue ports only
// Constants used in SETUP_ADC_PORTS() are:
#define NO_ANALOGS 7 // None
#define ALL_ANALOG 0 // A0 A1 A2 A3 A5 E0 E1 E2
#define AN0_AN1_AN2_AN4_AN5_AN6_AN7_VSS_VREF 1 // A0 A1 A2 A5 E0 E1 E2 VRefh=A3
#define AN0_AN1_AN2_AN3_AN4 2 // A0 A1 A2 A3 A5
#define AN0_AN1_AN2_AN4_VSS_VREF 3 // A0 A1 A2 A5 VRefh=A3
#define AN0_AN1_AN3 4 // A0 A1 A3
#define AN0_AN1_VSS_VREF 5 // A0 A1 VRefh=A3
#define AN0_AN1_AN4_AN5_AN6_AN7_VREF_VREF 0x08 // A0 A1 A5 E0 E1 E2 VRefh=A3 VRefl=A2
#define AN0_AN1_AN2_AN3_AN4_AN5 0x09 // A0 A1 A2 A3 A5 E0
#define AN0_AN1_AN2_AN4_AN5_VSS_VREF 0x0A // A0 A1 A2 A5 E0 VRefh=A3
#define AN0_AN1_AN4_AN5_VREF_VREF 0x0B // A0 A1 A5 E0 VRefh=A3 VRefl=A2
#define AN0_AN1_AN4_VREF_VREF 0x0C // A0 A1 A5 VRefh=A3 VRefl=A2
#define AN0_AN1_VREF_VREF 0x0D // A0 A1 VRefh=A3 VRefl=A2
#define AN0 0x0E // A0
#define AN0_VREF_VREF 0x0F // A0 VRefh=A3 VRefl=A2
i will consider that for
#define AN0 0x0E // A0
only pin 2 is used as analogue port rest are digital ... i hope am right
thanx for the help |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Tue Mar 27, 2007 2:24 pm |
|
|
Quote: | Only pin 2 is used as analogue port rest are digital |
That's right. That's a list of the combinations of pins that
can be configured as analog pins. In each #define statement,
any pins that are not list will be configured as digital pins.
Also, when we talk about the analog pins, we normally refer to
them by their name: AN0, AN1, AN2, etc. That's because the
actual pin number may vary, depending upon the package used,
or the PIC that you're using. |
|
|
ali6094
Joined: 31 Jan 2007 Posts: 18
|
|
Posted: Tue Mar 27, 2007 3:44 pm |
|
|
thanx my friend that was a real help |
|
|
|