|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
||||
|
||||
|
Hardware Interrupts in LabVIEW
Has anyone been successful in triggering an interrupt using a DIO in LabVIEW? I have verified that my signal is present on the correct DIO port and have tried different DIO ports, but still no luck.
Anyone care to give it a try? |
|
#2
|
||||
|
||||
|
Re: Hardware Interrupts in LabVIEW
Quote:
Some things to keep in mind, the DIO ports are pulled high to 3.3V using a 40 kOhm resistor. If you want to trigger something, you have to pull that signal to ground. You'll probably want to use a falling-edge trigger. |
|
#3
|
||||
|
||||
|
Re: Hardware Interrupts in LabVIEW
We used them last year in LabVIEW and they worked.
Can we see a screenshot of your code? Including the Open VI and then the actual wait for interrupt VI. |
|
#4
|
||||
|
||||
|
Re: Hardware Interrupts in LabVIEW
Here's the code! Ignore everything else around it except for the interrupt.
![]() This code should blink the "Timed Out" LED 5 times/sec. There is a square wave going into MXP DIO0 on the RoboRIO. Thanks! Last edited by juchong : 11-01-2016 at 20:48. |
|
#5
|
||||
|
||||
|
Re: Hardware Interrupts in LabVIEW
There are several mistakes that I see. From what I can tell (and would have been important to mention) is that you're trying to create an interrupt for your gyro.
1) The Interrupt Wait block will wait indefinitely for an interrupt. The timeout is disabled by default, and you do not have a non-default value going into it. So once your interrupt hits, it will return 'false' on the Wait block, no matter what (since the timeout is disabled). So it will always output 'false' to the "Timed Out" indicator. 2) You should not have any sleep timers in an interrupt able loop. That sort of defeats the purpose of an interrupt (meaning to do something immediately). If your gyro is creating an interrupt 1000 times per second, it will still only read it 5 times per second because of that 200ms wait. 3) You mention that there is a square wave. Is that a constant square wave, or just one transition, from say, low to high. Keep in mind that the all of the DIO ports are pulled-up internally to 3.3V on the RoboRIO using a 40k resistor. Did you measure that while it was connected to the RoboRIO? I have a feeling that the gyro might pull-down when not asserting the interrupt, and pushing high when asserting the interrupt. That won't work with the RoboRIO. You'll have to create invert that signal going in. Lucky for you, I can barely make out that you have an IMU 16448, which I think means you have an Analog Devices ADIS16448. Take a look at Page 20 in the datasheet. The Data Ready indicator (aka your interrupt) can be inverted by setting MSC_CTL[2:0] to 100 or 101, depending on which ADIS DIO port you're using (DIO2 = 101, DIO1 = 100). Let me know if that helps. |
|
#6
|
||||
|
||||
|
Re: Hardware Interrupts in LabVIEW
Quote:
1) I assumed that the Interrupt block's default was -1, not 0. I've added a -1 to the timeout input to hopefully fix this issue. 2) I'm not sure I agree. An interrupt (in the embedded world) means "stop what you're doing, do this other thing, and return to what you were doing". In this case, I'm trying to improve the 448 sampling by only reading data from the sensor when it outputs valid data (~100 Hz) instead of polling the sensor and hopefully catching valid data. For this specific example however, I'm just trying to understand what the interrupts actually do on the RoboRIO. 3) There is a data ready signal being output from the sensor to MXP DIO0. I have verified that the signal looks as it should (data valid = high) using an oscilloscope connected to MXP DIO0. I hadn't taken into account the pull-up resistor, but do I need to? Even though there is a pull-up resistor on the DIO, as long as I configure the interrupt to trigger off the proper edge it shouldn't matter. The sensor should pull the pin low however I configure it since it doesn't high-z when inactive. I've made the changes to the code using your feedback below: ![]() Last edited by juchong : 12-01-2016 at 21:51. |
|
#7
|
||||
|
||||
|
Re: Hardware Interrupts in LabVIEW
Quote:
Quote:
Quote:
Quote:
|
|
#8
|
||||
|
||||
|
Re: Hardware Interrupts in LabVIEW
Something like this:
Last edited by RyanN : 13-01-2016 at 09:03. |
|
#9
|
||||
|
||||
|
Re: Hardware Interrupts in LabVIEW
Thanks for your help Ryan! I managed to get the ADIS16448 example to work using interrupts instead of constantly reading the registers and coming up with a pseudo-dt. Check out the code here: https://github.com/juchong/ADIS16448-RoboRIO-Driver
And if you want an IMU to play with, get one here: http://firstchoicebyandymark.com/fc16-115 |
|
#10
|
||||
|
||||
|
Re: Hardware Interrupts in LabVIEW
Quote:
|
|
#11
|
|||
|
|||
|
Re: Hardware Interrupts in LabVIEW
Do you know if the ADIS16448 can be used for determining the robot's relative position? I understand how to find heading information, but is there sufficient resolution to integrate the acceleration to get relative position on the field?
Does the ADIS16448 device have more/different features from the NavX device? |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|