View previous topic :: View next topic |
Author |
Message |
young
Joined: 24 Jun 2004 Posts: 285
|
sAN0 and sAN2 adc conversion setup |
Posted: Wed Jul 28, 2004 1:28 pm |
|
|
May I setup port A0, A1, A3 and ADC port in 16f675 as
Code: |
setup_adc_ports(sAN0|sAN1|sAN2);
|
|
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Wed Jul 28, 2004 1:51 pm |
|
|
Quote: | May I setup port A0, A1, A3 and ADC port in 16f675 as
setup_adc_ports(sAN0|sAN1|sAN2); |
Yes, that's the way it works, except that you specified A0, A1, and A3,
so you should use sAN3 as the last parameter, and not sAN2. Example:
Code: | setup_adc_ports(sAN0|sAN1|sAN3); |
|
|
|
young
Joined: 24 Jun 2004 Posts: 285
|
|
Posted: Wed Jul 28, 2004 2:02 pm |
|
|
Thank you PCM:
How about if I want to set A0, A1, A2 as ADC port, A3 as digital input A4, A5 as output?
Is it like
Code: |
set_tris_a(0b00001111); setup_adc_ports(sAN0|sAN1|sAN2);
|
first set a0-a2 as output then set it as adc input right? |
|
|
SherpaDoug
Joined: 07 Sep 2003 Posts: 1640 Location: Cape Cod Mass USA
|
|
Posted: Wed Jul 28, 2004 2:26 pm |
|
|
You can't always do all combinations. The place to look is the chip's data sheet. It will tell you what is possible. _________________ The search for better is endless. Instead simply find very good and get the job done. |
|
|
|