Go to Post FIRST Championships event is not about winning, its about the experience, the atmosphere, the people and the sites, there are a lot of amazing things to see at The Championships. - Mike Schroeder [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 21-02-2004, 14:42
Neal Turett Neal Turett is offline
Registered User
#0201
 
Join Date: Nov 2002
Location: Rochester Hills
Posts: 34
Neal Turett is on a distinguished road
GeneratePWMS

I'm trying to read in a PWM. How do I do this?

On the edubot, they have the "setup who control pwms" function that changes the pwm_mask variable in the tx_data struct, but what does this do for me? This variable exists in the FRC code, so I can change it there, but I don't understand how this gets me input since there is no place for pwm inputs in the rx_data structure.
  #2   Spotlight this post!  
Unread 21-02-2004, 14:46
WCS V WCS V is offline
Registered User
#1168 (Malvern Prep Robotics)
Team Role: Programmer
 
Join Date: Feb 2004
Location: Malvern, PA
Posts: 16
WCS V is an unknown quantity at this point
Re: GeneratePWMS

Why do you want to use a pwm as an input?
__________________
WCS - Chief Technology Officer Malvern Prep Robotics #1168
"I can only do that in the code if its physically possible for it to happen."
  #3   Spotlight this post!  
Unread 21-02-2004, 16:55
Neal Turett Neal Turett is offline
Registered User
#0201
 
Join Date: Nov 2002
Location: Rochester Hills
Posts: 34
Neal Turett is on a distinguished road
Re: GeneratePWMS

some sensors allow I2C input or PWM input, and we don't have access to the I2C
  #4   Spotlight this post!  
Unread 21-02-2004, 18:44
steven114 steven114 is offline
Programming Wizard and Team Captain
AKA: Steven Schlansker
FRC #0114 (Eaglestrike)
Team Role: Programmer
 
Join Date: Feb 2004
Location: Los Altos, CA
Posts: 335
steven114 is a jewel in the roughsteven114 is a jewel in the roughsteven114 is a jewel in the rough
Send a message via AIM to steven114
Re: GeneratePWMS

I believe that there are a few #define statements in one of the header file that change PWMs 13-16 to either IFI_PWM or USER_CCP. That might be what you're looking for...
  #5   Spotlight this post!  
Unread 21-02-2004, 20:13
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: GeneratePWMS

Quote:
Originally Posted by steven114
I believe that there are a few #define statements in one of the header file that change PWMs 13-16 to either IFI_PWM or USER_CCP. That might be what you're looking for...
No, that's not it. The Setup_PWM_Output_Type() function is to set up the specifics of the PWM signal. if you don't use IFI_PWM for all 4, you have to set it up yourself (see comment in the default code). this is done in User_Initialization().
  #6   Spotlight this post!  
Unread 21-02-2004, 20:30
steven114 steven114 is offline
Programming Wizard and Team Captain
AKA: Steven Schlansker
FRC #0114 (Eaglestrike)
Team Role: Programmer
 
Join Date: Feb 2004
Location: Los Altos, CA
Posts: 335
steven114 is a jewel in the roughsteven114 is a jewel in the roughsteven114 is a jewel in the rough
Send a message via AIM to steven114
Re: GeneratePWMS

Quote:
Originally Posted by Astronouth7303
No, that's not it. The Setup_PWM_Output_Type() function is to set up the specifics of the PWM signal. if you don't use IFI_PWM for all 4, you have to set it up yourself (see comment in the default code). this is done in User_Initialization().
I think that that's what I was talking about, sorry, I didn't have the code in front of me...
  #7   Spotlight this post!  
Unread 23-02-2004, 23:26
Neal Turett Neal Turett is offline
Registered User
#0201
 
Join Date: Nov 2002
Location: Rochester Hills
Posts: 34
Neal Turett is on a distinguished road
Re: GeneratePWMS

Thanks guys. I found a way to do it. Took some experimenting, but here it is:

Run the sensor output into digital inputs 2 and 3. Have interupt on 2 for the rising edge and one for the falling edge. The first starts the timer, the second reads it out and scales it.

I haven't actually tried this - I'll probably fool with it post-build season, but I was just thinking ahead since my team doesn't let me touch the bot. Something about building it....

Last edited by Neal Turett : 23-02-2004 at 23:28. Reason: lots of typos
  #8   Spotlight this post!  
Unread 24-02-2004, 00:56
Jay Lundy Jay Lundy is offline
Programmer/Driver 2001-2004
FRC #0254 (The Cheesy Poofs)
Team Role: Alumni
 
Join Date: Jun 2001
Rookie Year: 2001
Location: Berkeley, CA
Posts: 320
Jay Lundy is a name known to allJay Lundy is a name known to allJay Lundy is a name known to allJay Lundy is a name known to allJay Lundy is a name known to allJay Lundy is a name known to all
Re: GeneratePWMS

Quote:
Originally Posted by Neal Turett
Thanks guys. I found a way to do it. Took some experimenting, but here it is:

Run the sensor output into digital inputs 2 and 3. Have interupt on 2 for the rising edge and one for the falling edge. The first starts the timer, the second reads it out and scales it.

I haven't actually tried this - I'll probably fool with it post-build season, but I was just thinking ahead since my team doesn't let me touch the bot. Something about building it....
You don't have to do it like that. Dig I/O pins 3-6 are interrupt on change, so just plug it into dig io pin 3 and when RBIF triggers check to see that it is indeed pin 3 that changed (since 3-6 all trigger the same flag). You can sense both rising and falling edges on the same pin.
  #9   Spotlight this post!  
Unread 24-02-2004, 01:05
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: GeneratePWMS

Quote:
Originally Posted by Jay Lundy
You don't have to do it like that. Dig I/O pins 3-6 are interrupt on change, so just plug it into dig io pin 3 and when RBIF triggers check to see that it is indeed pin 3 that changed (since 3-6 all trigger the same flag). You can sense both rising and falling edges on the same pin.
Just FYI, interrupts 1 and 2 can also exhibit this behavior if you flip the INTEDGx bit in the interrupt handler. As a starting point, I'd suggest using the code in receiver.c/.h because it pretty much does exactly what you need to do (pulse width discrimination). I'm not sure if it's usable (IFI may have wired-in a output buffer on the CCP pins), but you might also look into using the CCP Capture mode to do this.

-Kevin
__________________
Kevin Watson
Engineer at stealth-mode startup
http://kevin.org
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 10:46.

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