Go to Post When I'm asked the question, "What is the most important computer language to learn to prepare me for a programming career?"; my answer is, "Your second one." - Greg McKaskle [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 05-02-2005, 18:56
Splintercell Splintercell is offline
Registered User
#0616 (S.I.R (Southampton Indian Robotics))
Team Role: Programmer
 
Join Date: Jan 2005
Location: Southampton, VA
Posts: 6
Splintercell is an unknown quantity at this point
Send a message via AIM to Splintercell
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   Spotlight this post!  
Unread 05-02-2005, 19:02
Astronouth7303's Avatar
Astronouth7303 Astronouth7303 is offline
Why did I come back?
AKA: Jamie Bliss
FRC #4967 (That ONE Team)
Team Role: Mentor
 
Join Date: Jan 2004
Rookie Year: 2004
Location: Grand Rapids, MI
Posts: 2,071
Astronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud ofAstronouth7303 has much to be proud of
Re: Initialize_ADC help???

Quote:
Originally Posted by Splintercell
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.
Why are you calling Initialize_ADC? I can't even find it! (Please tell me this isn't some new thing I missed.)

To use multiple analog channels, just call Get_Analog_Value() using two different pins.
  #3   Spotlight this post!  
Unread 05-02-2005, 19:05
Splintercell Splintercell is offline
Registered User
#0616 (S.I.R (Southampton Indian Robotics))
Team Role: Programmer
 
Join Date: Jan 2005
Location: Southampton, VA
Posts: 6
Splintercell is an unknown quantity at this point
Send a message via AIM to Splintercell
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   Spotlight this post!  
Unread 05-02-2005, 19:16
kjohnson's Avatar
kjohnson kjohnson is offline
Insert Clever Title Here
AKA: Kyle J.
FRC #1610 (BOT)
Team Role: Mentor
 
Join Date: Jan 2004
Rookie Year: 2004
Location: Virginia
Posts: 575
kjohnson has a reputation beyond reputekjohnson has a reputation beyond reputekjohnson has a reputation beyond reputekjohnson has a reputation beyond reputekjohnson has a reputation beyond reputekjohnson has a reputation beyond reputekjohnson has a reputation beyond reputekjohnson has a reputation beyond reputekjohnson has a reputation beyond reputekjohnson has a reputation beyond reputekjohnson has a reputation beyond repute
Re: Initialize_ADC help???

Quote:
Originally Posted by Splintercell
I'm using Initializa_ADC from some of Kevin's code. I'll try working with that, thanks.
By Kevin he means Kevin Watson. You can reach his website here.
  #5   Spotlight this post!  
Unread 05-02-2005, 23:41
Robby's Avatar
Robby Robby is offline
Registered User
AKA: Kevin Beranek
FRC #0269 (Cooney Robotics)
Team Role: College Student
 
Join Date: Jan 2004
Rookie Year: 2003
Location: Wisconsin
Posts: 47
Robby has a spectacular aura aboutRobby has a spectacular aura about
Re: Initialize_ADC help???

Quote:
Originally Posted by Splintercell
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.

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   Spotlight this post!  
Unread 06-02-2005, 07:48
Splintercell Splintercell is offline
Registered User
#0616 (S.I.R (Southampton Indian Robotics))
Team Role: Programmer
 
Join Date: Jan 2005
Location: Southampton, VA
Posts: 6
Splintercell is an unknown quantity at this point
Send a message via AIM to Splintercell
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   Spotlight this post!  
Unread 06-02-2005, 11:06
Kevin Watson's Avatar
Kevin Watson Kevin Watson is offline
La Caņada High School
FRC #2429
Team Role: Mentor
 
Join Date: Jan 2002
Rookie Year: 2001
Location: La Caņada, California
Posts: 1,335
Kevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond repute
Re: Initialize_ADC help???

Quote:
Originally Posted by Splintercell
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.
What are you trying to do with your code? You mentioned that you wanted to do two simultaneous ADC conversions. This cannot be done because there is only one ADC on-board. You have to select the channel to convert (which automatically starts a conversion), wait for it to finish, grab the data, select new channel, wait for it to finish, ...

-Kevin
__________________
Kevin Watson
Engineer at stealth-mode startup
http://kevin.org
  #8   Spotlight this post!  
Unread 06-02-2005, 13:22
Splintercell Splintercell is offline
Registered User
#0616 (S.I.R (Southampton Indian Robotics))
Team Role: Programmer
 
Join Date: Jan 2005
Location: Southampton, VA
Posts: 6
Splintercell is an unknown quantity at this point
Send a message via AIM to Splintercell
Re: Initialize_ADC help???

Thanks a bunch Kevin, I'll get back to this code now. (almost got it )
  #9   Spotlight this post!  
Unread 06-02-2005, 13:47
Splintercell Splintercell is offline
Registered User
#0616 (S.I.R (Southampton Indian Robotics))
Team Role: Programmer
 
Join Date: Jan 2005
Location: Southampton, VA
Posts: 6
Splintercell is an unknown quantity at this point
Send a message via AIM to Splintercell
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   Spotlight this post!  
Unread 06-02-2005, 16:46
Robby's Avatar
Robby Robby is offline
Registered User
AKA: Kevin Beranek
FRC #0269 (Cooney Robotics)
Team Role: College Student
 
Join Date: Jan 2004
Rookie Year: 2003
Location: Wisconsin
Posts: 47
Robby has a spectacular aura aboutRobby has a spectacular aura about
Re: Initialize_ADC help???

Quote:
Originally Posted by Splintercell
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 ?

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
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 19:18.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi