![]() |
Using Interrupts on Digital Inputs
Is there any example code on using interrupts on digital inputs via Windriver?
Also, are there any restrictions on which digital inputs can be used via interrupts? |
Re: Using Interrupts on Digital Inputs
Any digital input pin is as good as any other. So far as I know, however, none of them will be able to generate interrupts that your code can respond to.
Why do you want an interrupt? The WPI library has support via the FPGA for pretty much anything you might otherwise need interrupts to implement. |
Re: Using Interrupts on Digital Inputs
Quote:
|
Re: Using Interrupts on Digital Inputs
Quote:
|
Re: Using Interrupts on Digital Inputs
We have some tasks based on limit switches which have high priority. Can't tell you much more than that since its proprietary... :yikes:
|
Re: Using Interrupts on Digital Inputs
If you look at the source for the DigitalInput class you will see virtual methods for using interrupt handlers. You can use a tInterruptHandler object to catch the interrupts.
|
Re: Using Interrupts on Digital Inputs
We have implemented interrupt handling for our limit switches, reset operations, autonomous goodies using GPIO and the DigitialInput class. Points to note to save you from our madness, the DIO sig pins are pulled high, therefore you switch them low to get response (then high again to get toggle). You will get switch bounce as the contacts come together and separate. You need to program against that. You also need to set the leading or trailing edge of the pulse correctly (the default is the wrong way round by my estimation in the DigitalInput interrupt handler), since the initial setup is to transition to 0v, you should only interrupt on the trailing pulse edge. If not, you will get an interrupt for the press and another for the release of the switch - unless you are interested in that granularity of course.
Good luck. I'll paste some code here to help. Tony 1711 Raptors Code:
#include "WPILib.h" |
| All times are GMT -5. The time now is 10:53 AM. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi