Go to Post You play your best, the refs do their best, and at the end of the day we are FIRST, collectively. - KenWittlief [more]
Home
Go Back   Chief Delphi > Technical > Programming > NI LabVIEW
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #6   Spotlight this post!  
Unread 12-01-2016, 21:43
juchong's Avatar
juchong juchong is offline
Electrical Engineer
AKA: Juan Chong
FRC #2655 (Flying Platypi)
Team Role: Engineer
 
Join Date: Aug 2008
Rookie Year: 2008
Location: Greensboro, NC
Posts: 105
juchong is a jewel in the roughjuchong is a jewel in the roughjuchong is a jewel in the rough
Re: Hardware Interrupts in LabVIEW

Quote:
Originally Posted by RyanN View Post
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.
Hi Ryan, thanks for the feedback! I don't have my RoboRIO with me to test the code, so I'll have to let you know the results tomorrow morning.

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:

__________________
Teams I've worked with:My Website: http://www.juanjchong.com/
What I do: Analog Devices iSensor Product Engineer

Last edited by juchong : 12-01-2016 at 21:51.
Reply With Quote
 


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:23.

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