Go to Post This, right here, is why I participate in FRC. Changing lives, one corndog at a time. - Jared Russell [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 22-01-2008, 16:19
RaiderRev RaiderRev is offline
Registered User
FRC #1984
 
Join Date: Jan 2008
Location: Shawnee Mission South
Posts: 2
RaiderRev is an unknown quantity at this point
Trouble Generaing PWM output

This competition is our teams first attempt at programming and we have been having some trouble generating any kind of PWM output. Right now we have a test area set up with the general electronics hooked up (2008 FRC robot controller, Victor, Motor, circuit berakers, etc..). We made sure to check the connections and everything has power. We also have the default code we are working with as well as the Kevin Watson's PWM code.

The only thing we are trying to do code wise so far is generate some type of output on any of the PWMs. Right now the only code that we have is in the user_routines.c, Process_Data_From_Master_uP(void) method and we are trying to get the motor connected to PWM13 to do a full reverse. We have tried other PWMs as well but it still doesnt have any effect.


void Process_Data_From_Master_uP(void)
{
static unsigned char i;

Getdata(&rxdata); /* Get fresh data from the master microprocessor. */

//Default_Routine(); /* Optional. See below. */

/* Add your own code here. (a printf will not be displayed when connected to the breaker panel unless a Y cable is used) */

//printf("Port1 Y %3d, X %3d, Fire %d, Top %d\r",pwm01,pwm05,p1_sw_trig,p1_sw_top); /* printf EXAMPLE */

printf("In User Mode");
pwm13 = 0;
printf("Set pwm13 to 0");


PWM(pwm13,pwm14,pwm15,pwm16);

/* Example code to check if a breaker was ever tripped. */

if (aBreakerWasTripped)
{
for (i=1;i<29;i++)
{
if (Breaker_Tripped(i))
User_Byte1 = i; /* Update the last breaker tripped on User_Byte1 (to demonstrate the use of a user byte)
Normally, you do something else if a breaker got tripped (ex: limit a PWM output) */
}
}

Putdata(&txdata); /* DO NOT CHANGE! */
}
  #2   Spotlight this post!  
Unread 22-01-2008, 17:03
Jon Stratis's Avatar
Jon Stratis Jon Stratis is offline
Electrical/Programming Mentor
FRC #2177 (The Robettes)
Team Role: Mentor
 
Join Date: Feb 2007
Rookie Year: 2006
Location: Minnesota
Posts: 3,746
Jon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond reputeJon Stratis has a reputation beyond repute
Re: Trouble Generaing PWM output

First question: Are you seeing the two printf statements in your terminal window?

Second question: can you post a picture of your setup?

The code looks just fine to me, it could very well be something with your setup.

Also, be aware that there are 12 "standard" PWM outputs (refreshed every 17mSec) and 4 "fast" PWM outputs (refreshed up to every 2mSec) - these could have an effect on what you want to do.

FWIW, we hooked our motors up to PWM01 and 02 last year, and had no problems controlling the robot - 17ms is still way faster than the combination between human perception and the ability to move the joystick to the desired location!
  #3   Spotlight this post!  
Unread 22-01-2008, 17:16
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: Trouble Generaing PWM output

Quote:
Originally Posted by RaiderRev View Post
We also have the default code we are working with as well as the Kevin Watson's PWM code.
When using my code, you need to call Initialize_PWM() from User_Initialization(). If you're using my 2008 base code, you don't need to to anything as the calls are done for you in main().

-Kevin
__________________
Kevin Watson
Engineer at stealth-mode startup
http://kevin.org
  #4   Spotlight this post!  
Unread 22-01-2008, 18:59
RaiderRev RaiderRev is offline
Registered User
FRC #1984
 
Join Date: Jan 2008
Location: Shawnee Mission South
Posts: 2
RaiderRev is an unknown quantity at this point
Re: Trouble Generaing PWM output

OK! We got it to do something. Our problem was that we did not have the radio device hooked up correctly so we were not getting output.

thanks for taking the time to help!
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
Non Contact Magnetic Encoder with PWM Output Tom Bottiglieri Programming 3 09-10-2005 01:19
trouble with pwm speed controller jakk Control System 4 10-01-2005 02:51
trouble with pwm speed controller jakk Electrical 4 10-01-2005 02:51
Trouble with pwm outputs misterikkit Programming 16 17-01-2004 10:56


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

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