View Single Post
  #7   Spotlight this post!  
Unread 13-01-2016, 06:51
RyanN's Avatar
RyanN RyanN is offline
RyanN
AKA: Ryan Nazaretian
FRC #4901 (Garnet Squadron)
Team Role: Mentor
 
Join Date: Jun 2006
Rookie Year: 2005
Location: Columbia, SC
Posts: 1,126
RyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond reputeRyanN has a reputation beyond repute
Re: Hardware Interrupts in LabVIEW

Quote:
Originally Posted by juchong View Post
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.
-1 disables the timeout. Your indicator will never be true. If it's supposed to trigger at 100 Hz, or every 10ms, maybe put a 50 or 100ms timeout on the device. Otherwise, the indicator will never light up.

Quote:
Originally Posted by juchong View Post
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".
Right. That's what I said, isn't it?

Quote:
Originally Posted by juchong View Post
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.
You had a 200ms wait in the while loop that will block the interrupt from doing what you needs it to do, which is read the data at 100 Hz. Remember that the while loop will only loop after all of the programming within the while loop has executed. If the 200ms wait is the slowest thing in the critical path within the while loop, then it will only loop at 5 Hz (much slower than the 100 Hz)

Quote:
Originally Posted by juchong View Post
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.
That word 'should'... You need to verify that part. Figure out a way to hook the oscilloscope to the signal while connected to the RoboRIO. That will tell the rest of the story.
__________________
Garnet Squadron
FRC 4901
Controls Mentor
@rnazaretian

Previous mentor and student from Team Fusion, FRC 364
Reply With Quote