![]() |
EDU Interrupt and Timer Template Code
To get the creative juices going for the coming build season, I've written some template code that will make the job of using interrupts and timers on the EDU controller much easier. It's somewhere around 800 lines of heavily annotated code that can be used alone or dropped into your own code. I've also re-written user_routines_fast.c to allow the use of all external and timer related interrupts. I'm also working on what I think are some cool demos using this code. If you have an idea on how to improve the code, find a bug or do something cool with it, leave a note here or e-mail me. Anyway, the zipped archive is located here. Have fun.
-Kevin |
Re: EDU Interrupt and Timer Template Code
Thank you this code is very helpful.
|
Re: EDU Interrupt and Timer Template Code
No problem. I'm glad you found it helpful.
-Kevin |
Re: EDU Interrupt and Timer Template Code
I wrote a small quadrature encoder interface using RB4-7 (ifi interrupt 3-6) and ran across a problem that doesnt appear to be addressed in your code: If you call a subroutine from an interrupt handler, you need to save additional stuff. You can find this in the C compiler in section 2.9 (something) or on the quick reference card. You need to replace
#pragma interrupt InterruptHandlerLow with #pragma interruptlow InterruptHandlerLow save=section(".tmpdata") For more info, see below: http://www.chiefdelphi.com/forums/sh...91&postcount=4 |
Re: EDU Interrupt and Timer Template Code
Hi Larry,
Thanks, I've had a few exchanges with folks about this via e-mail already and will make some changes to the code and do some testing this evening. It's strange in that I haven't had any problems with a couple of other applications that I've written lately. One, a motor controller, receives many hundreds of interrupts a second from an encoder, yet I've never had a problem (actually, while doing some testing, I found that I could handle a peak interrupt rate of just over 5,000 interrupts/sec and still see no wierdness). -Kevin |
Re: EDU Interrupt and Timer Template Code
Quote:
Even with the fix, that interrupt rate crashes the EDU system. It seems that 10-20k/sec is about as fast as it can go. Which is good since a 2 segment wheel on the back of a Boch motor generates about 5k/sec at full speed. |
Re: EDU Interrupt and Timer Template Code
Quote:
|
Re: EDU Interrupt and Timer Template Code
I've updated the template code to better handle low-priority interrupts.
It can be found here: http://kevin.org/frc. -Kevin |
Re: EDU Interrupt and Timer Template Code
"The Lucas" found a bug in my code related to timers 3/4 (thanks, Dude), so if you're using the interrupt and timer code that I posted, you might want to download the updated version from here: http://kevin.org/frc.
-Kevin |
| All times are GMT -5. The time now is 00:34. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi