View Single Post
  #2   Spotlight this post!  
Unread 25-01-2004, 20:59
mtrawls's Avatar
mtrawls mtrawls is offline
I am JVN! (John von Neumann)
#0122 (NASA Knights)
Team Role: Programmer
 
Join Date: Mar 2003
Location: Hampton, VA
Posts: 295
mtrawls is a splendid one to beholdmtrawls is a splendid one to beholdmtrawls is a splendid one to beholdmtrawls is a splendid one to beholdmtrawls is a splendid one to beholdmtrawls is a splendid one to beholdmtrawls is a splendid one to behold
Send a message via AIM to mtrawls
Re: FRC Code (Motors, etc...)

Quote:
Originally Posted by Raven_Writer
Ok, if my memory serves me correctly, the default code uses the PWM01 & PWM08 for motor movement. Is there a way to change this? Also, how do you use PWM's exactly (I was dropped from the programmer's group last year, so most of the stuff left my mind)?
Look at their Default_Routine function in user_routines.c for their joystick code. Specifically, here:

Code:
 /*---------- 1 Joystick Drive ----------------------------------------------
  *--------------------------------------------------------------------------
  *  This code mixes the Y and X axis on Port 1 to allow one joystick drive. 
  *  Joystick forward  = Robot forward
  *  Joystick backward = Robot backward
  *  Joystick right    = Robot rotates right
  *  Joystick left     = Robot rotates left
  *  Connect the right drive motors to PWM13 and/or PWM14 on the RC.
  *  Connect the left  drive motors to PWM15 and/or PWM16 on the RC.
  */  
  pwm13 = pwm14 = Limit_Mix(2000 + p1_y + p1_x - 127);
  pwm15 = pwm16 = Limit_Mix(2000 + p1_y - p1_x + 127);
How do you use PWMs? Well, a lot could be said here, I suppose. The simple answer: set pwmXX to whatever value you want it set to! Then, make sure that you have the speed controller (or whatever else you're working with), hooked up, via a pwm cable, to the proper place on the controller (i.e., corresponding to what is used in the code, or either change which is used in the code to correspond to how you hooked up). A more specific question, (suprise), would elicit a more specific response, but ... All you really have to do is output some value to the variable pwmXX, and if you've got something plugged into the right pwm slot then it will do what it is supposed to (ideally )