|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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
|
||||
|
||||
|
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; -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
|
|||
|
|||
|
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
|
||||
|
||||
|
Re: turning inputs into outputs
Quote:
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
|
||||
|
||||
|
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 |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
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 |