Go to Post To put it simply: An adult coach impacts a team for two minutes. An adult mentor impacts a team for a lifetime. - dlavery [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 19-04-2007, 17:33
Huron Warriors Huron Warriors is offline
Registered User
no team
 
Join Date: Apr 2007
Location: Canada
Posts: 2
Huron Warriors is an unknown quantity at this point
turning inputs into outputs

Hi I am programming for Vex and using mplab so my source code is similar to FIRST. I am programming a vex robot and i was wondering is there a way to use the analog/digital inputs to control the motors like they are controlled by the designated outputs on the microcontroller?

Thanks for you time

Sincerly

Chris Lowson

A Huron Heights Robtic Programmer

Last edited by Huron Warriors : 19-04-2007 at 17:35. Reason: changing title
  #2   Spotlight this post!  
Unread 19-04-2007, 17:55
Bongle's Avatar
Bongle Bongle is offline
Registered User
FRC #2702 (REBotics)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2002
Location: Waterloo
Posts: 1,069
Bongle has a reputation beyond reputeBongle has a reputation beyond reputeBongle has a reputation beyond reputeBongle has a reputation beyond reputeBongle has a reputation beyond reputeBongle has a reputation beyond reputeBongle has a reputation beyond reputeBongle has a reputation beyond reputeBongle has a reputation beyond reputeBongle has a reputation beyond reputeBongle has a reputation beyond repute
Send a message via MSN to Bongle
Re: turning inputs into outputs

In FRC, a very simple version (that you could put in your main user routines) would look like:

This is for the 2006 FRC controller, things may have changed since then.
Code:
unsigned int analog_value,output_value;

// this is a 10-bit value, which means it is between 0 and 1024
analog_value = Get_Analog_Value(rc_ana_in01); 

// chops off the 2 least significant bits to make it an 8-bit value
output_value = analog_value>>2;

// the pwm outputs are all 8-bit
pwm01 = output_value;
Things that may be different for the vex controller, and I'm not sure of:
-The analog inputs may be a different # of bits than the FRC controller is, so you'd have to remove more or less of the least significant bits
-The Get_Analog_Value function may be different. In any case, there should be some function defined in all the ifi_blah.h files that allows you to retrieve the analog input values


Edit: Is that Huron Heights in the Kitchener/Waterloo region?
Edit2: I'm guessing it is the Huron Heights in Newmarket. Did you guys get started from 1281?

Last edited by Bongle : 19-04-2007 at 18:00.
  #3   Spotlight this post!  
Unread 19-04-2007, 19:00
Huron Warriors Huron Warriors is offline
Registered User
no team
 
Join Date: Apr 2007
Location: Canada
Posts: 2
Huron Warriors is an unknown quantity at this point
Re: turning inputs into outputs

I believe that you did not understand us correctly. Our problem is that we only have 8 pwm outputs on the microcontroller. we would like to add 2 more motors to our system and controll them separately using other pins, like the digital/analog inputs - but we cant seem to get the motor working on these correctly. After we turn pin14 on digital inputs into an output pin, the motor randomly jerks, we guess it doesnt recieve enough voltage, but we havent tested that yet, anyways - still looking for a reply.

P.S - yes, we are Huron heights from Newmarket. We guess we are speaking to Alex Mac - hey guys, nice to meet ya here.
  #4   Spotlight this post!  
Unread 19-04-2007, 19:50
Bongle's Avatar
Bongle Bongle is offline
Registered User
FRC #2702 (REBotics)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2002
Location: Waterloo
Posts: 1,069
Bongle has a reputation beyond reputeBongle has a reputation beyond reputeBongle has a reputation beyond reputeBongle has a reputation beyond reputeBongle has a reputation beyond reputeBongle has a reputation beyond reputeBongle has a reputation beyond reputeBongle has a reputation beyond reputeBongle has a reputation beyond reputeBongle has a reputation beyond reputeBongle has a reputation beyond repute
Send a message via MSN to Bongle
Re: turning inputs into outputs

Quote:
Originally Posted by Huron Warriors View Post
I believe that you did not understand us correctly. Our problem is that we only have 8 pwm outputs on the microcontroller. we would like to add 2 more motors to our system and controll them separately using other pins, like the digital/analog inputs - but we cant seem to get the motor working on these correctly. After we turn pin14 on digital inputs into an output pin, the motor randomly jerks, we guess it doesnt recieve enough voltage, but we havent tested that yet, anyways - still looking for a reply.
Oh, whoops. As you can guess, I read it as "we want to read from the analog inputs, then drive a motor with that value".

After reading innovationfirst's docs, it looks like it could be possible. In the spec sheet, they say that the analog interrupt ports CAN be used as outputs and can drive "open circuits".

I don't know enough about VEX or the PIC hardware to help beyond that. Good luck!

If I was doing the programming, I'd look at the various IFI functions that access the ADC and see if you can find some that might let you set values. The OpenADC function called from ifi_utilities.c looks hopeful.
  #5   Spotlight this post!  
Unread 19-04-2007, 22:10
Qbranch Qbranch is offline
wow college goes fast.
AKA: Alex
FRC #1024 (Kil-A-Bytes)
Team Role: Alumni
 
Join Date: Apr 2006
Rookie Year: 2006
Location: Indianapolis
Posts: 1,174
Qbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond reputeQbranch has a reputation beyond repute
Re: turning inputs into outputs

Are you outputting a PWM signal? Or did you just set the tristate to 1?

also you might want to have a look at this post of mine... it might help a little.

if you arent outputting PWM, you'll need to set up a timer or CCP to use as a PWM timebase and another CCP for each individual motor channel.... also you'll need to see what pins on the microcontroller are connected to which pins on the I/O pins...

is this what you need? either way let me know.

-q
__________________
Electrical Engineer Illini
1024 | Programmer '06, '07, '08 | Driver '08
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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Got Gyro? PhilBot Control System 18 27-01-2007 14:57
I've got a favor/question for Chesapeake attendees Mindstorm Regional Competitions 2 16-03-2006 14:45
Got an question on start postion of the robot? DanTheRobotMan Rules/Strategy 9 12-01-2006 17:32
I got GAME! Goober!!! Games/Trivia 3 07-02-2005 21:43
got Countdown? archiver 2001 3 24-06-2002 03:40


All times are GMT -5. The time now is 09:00.

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