Go to Post Of course 254 owns Battlebots too - dodar [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, 13:14
doy's Avatar
doy doy is offline
#1208 Ex-Lead Programmer
AKA: Jesse Luehrs
#1208 (The Super Critical Axe Men)
Team Role: Alumni
 
Join Date: Jan 2004
Location: O'Fallon, IL
Posts: 27
doy is on a distinguished road
Send a message via AIM to doy
interrupts and putdata()

for our autonomous program, we are planning on using interrupts to control the motor speeds at specific intervals... i was just wondering if it was safe to call Putdata() more often than we call Getdata(). for example, if in the interrupt handler which executes say every 30-40 ms, we would modify the value of the pwms from a lookup table we have, and then we call putdata() to put those values on the actual pwms... is this going to cause problems anywhere? or can the pwm outputs only be changed every 26.2 ms no matter what?

Last edited by doy : 21-02-2004 at 13:14. Reason: title clarification
  #2   Spotlight this post!  
Unread 21-02-2004, 15:50
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: interrupts and putdata()

From my testing, it looks like the only thing that causes the processor to choke is if you don't call PutData often enough. You can call GetData whenever you want, and you can call PutData as often as you want as long as it's more often than the cutoff time (not sure what that is).

I'm not sure if the master updates the pwms every time PutData is called, or just every 26.2 ms.
  #3   Spotlight this post!  
Unread 23-02-2004, 13:14
Greg's Avatar
Greg Greg is offline
Registered User
FRC #1075 (Sinclair Sprockets)
Team Role: College Student
 
Join Date: Nov 2002
Rookie Year: 2003
Location: Whitby, Ontario, Canada
Posts: 108
Greg is on a distinguished road
Send a message via ICQ to Greg Send a message via MSN to Greg
Re: interrupts and putdata()

I just finished testing exactly this code on the EDU controller. It works fine as long as there are no conflicts with the values that your fast and slow code sections output. I wrote the code for the fast section, and forgot that the slow section would output 127 every 26 msec The edu motor sounded really weird as a result. As soon as I figured this out though everything worked.

I am not sure if updating the values that quickly will actually do any good, however. Even if the speed controller can respond this quickly to the change in PWM, the motors and the drivetrain certainly won't. Inertia in the drivetrain will erase all difference between fast and slow updates, I think. If I'm wrong please correct me on this.
  #4   Spotlight this post!  
Unread 23-02-2004, 13:17
Jeff McCune's Avatar
Jeff McCune Jeff McCune is offline
Alpha Geek
#0677 (The Wirestrippers)
Team Role: Mentor
 
Join Date: Jan 2003
Location: The Ohio State University
Posts: 67
Jeff McCune is on a distinguished road
Send a message via ICQ to Jeff McCune Send a message via AIM to Jeff McCune
Re: interrupts and putdata()

It's fine to call putdata more often than needed, but it would probably be a bad idea to call putdata from an interrupt handler because of timing issues. The interrupt pin would be disabled for as long as putdata would take to execute. I'd just set your PWM values and call putdata as you normally do.
__________________
Team 677 - The Wirestrippers - Columbus School for Girls and The Ohio State University
EMAIL: mccune@ling.ohio-state.edu

...And all you touch and all you see
Is all your life will ever be...
  #5   Spotlight this post!  
Unread 23-02-2004, 22:45
Ryan Cumings's Avatar
Ryan Cumings Ryan Cumings is offline
Programmer and University Rejected
#0134 (Team Discovery)
Team Role: Programmer
 
Join Date: Jan 2004
Rookie Year: 2000
Location: Pembroke, NH
Posts: 65
Ryan Cumings is an unknown quantity at this point
Send a message via AIM to Ryan Cumings
Re: interrupts and putdata()

Quote:
Originally Posted by Jeff McCune
It's fine to call putdata more often than needed, but it would probably be a bad idea to call putdata from an interrupt handler because of timing issues. The interrupt pin would be disabled for as long as putdata would take to execute. I'd just set your PWM values and call putdata as you normally do.
You may want to just use the Generate PWM function which will update PWMs 13,14,15,16 without needing to call putdata.
__________________
Suddenly being rejected from college feels right during the build season. Now I am a mentor.
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
Interrupts per second steven114 Programming 10 17-02-2004 13:59
INT2 and INT3 interrupts not working Mercutio Programming 4 01-02-2004 13:27
EDU Demo Code: Encoder Interfacing Using Interrupts Kevin Watson Programming 4 08-01-2004 23:14
Interrupts Questions mightywombat Programming 0 03-01-2004 14:50
Problem with interrupts on the PIC Mike Betts Programming 7 16-12-2003 21:26


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

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