|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||
|
|||
|
Initialize_ADC help???
Hey, does anyone know if you can run 2 devices at once on different analog pins using the Initialize_ADC? If so can someone please point me in the right direction. Any help is greatly appreciated.
|
|
#2
|
|||||
|
|||||
|
Re: Initialize_ADC help???
Quote:
To use multiple analog channels, just call Get_Analog_Value() using two different pins. |
|
#3
|
|||
|
|||
|
Re: Initialize_ADC help???
I'm using Initialize_ADC from some of Kevin's code. I'll try working with that, thanks.
Last edited by Splintercell : 05-02-2005 at 20:27. |
|
#4
|
||||
|
||||
|
Re: Initialize_ADC help???
Quote:
|
|
#5
|
||||
|
||||
|
Re: Initialize_ADC help???
Quote:
i'm not absolutely sure on this, but i have two ideas 1) i would imagine that you would need to periodically switch which pin the adc is set to. In order to do this, i think all you need to do is just change the ADCON0bits.CHSx bit to reflect which analog input you wish you use 2) after looking through the default code i noticed how they get analog values. When you call Get_Analog_Value() it makes a call to OpenADC(), i imagine you could use the same code, i believe the function it refers to is in adc.h i hope i adressed what you were looking for |
|
#6
|
|||
|
|||
|
Re: Initialize_ADC help???
Thanks, I'm going to have to look around on this, but I hope it works. I have changed the ADCON0bits.CHSx to diferent pins, but I have yet to get two different pins to work in the same code. It either doesn't work or tells me the error I posted previously. I'll try the OenADC() and see if it works. Thanks again all.
Last edited by Splintercell : 06-02-2005 at 07:55. |
|
#7
|
||||
|
||||
|
Re: Initialize_ADC help???
Quote:
-Kevin |
|
#8
|
|||
|
|||
|
Re: Initialize_ADC help???
Thanks a bunch Kevin, I'll get back to this code now. (almost got it
) |
|
#9
|
|||
|
|||
|
Re: Initialize_ADC help???
Kevin,
What our goal is to initialize the ADC one time, but to activate 2 analog pins during the call. That way we can have 2 inputs ready for us to grab when we want them. Is this possible and if so how ? |
|
#10
|
||||
|
||||
|
Re: Initialize_ADC help???
Quote:
i had one more thought, if you want to use 2 analog pins i am assuming that you are using a gyro and accelerometer at the same time, i actually just considered doing this myself and here's my latest idea: set your timer to interrupt twice as frequently as needed for each device and then take the output from the adc for different pins each time. This may be too much of a burden on your system depending on what you are doing so you could just keep the same timer rate and alternate pins each time, but most likely this would be too slow for your purposes |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|