atk_nut Posted July 14, 2007 Report Share Posted July 14, 2007 Hi there, I would like to fire an event in an event structure based on a digital input from a daq device (button press). Does anyone out there have an example of that? Can I do it? Thanks. Quote Link to comment
crelf Posted July 14, 2007 Report Share Posted July 14, 2007 This would be a great place to use "user" events - have a parallel loop watching the DAQ card and fire a user event when it sees the transition. Try "Find Examples" for "user event". Quote Link to comment
rpursley Posted July 14, 2007 Report Share Posted July 14, 2007 QUOTE(crelf @ Jul 13 2007, 01:51 PM) This would be a great place to use "user" events - have a parallel loop watching the DAQ card and fire a user event when it sees the transition. Try "Find Examples" for "user event". Attached is an image of a test program I built for just that purpose. I defined an AI task named Monitor and register it as a User Event. You have a few choices of Events to choose from, I selected Done. Then register this event with the event structure. Hook your button up to the PFI line and when the button is pushed it will start this acquisition and when the acquisition is done, the event will fire. In my case, I use PFI0 to start my acquisition (an external trigger from an MRI) and then switch over to PFI1 to register each button push from a test subject (PFI1 is the wired-OR response of four push buttons, and after getting this trigger my task checks all four buttons to see which has been pushed). My AI task acquires 10 points at 1 kHz, so the event is 'Done' 10 ms after the trigger. Quote Link to comment
crelf Posted July 15, 2007 Report Share Posted July 15, 2007 QUOTE(rpursley @ Jul 14 2007, 07:15 AM) Attached is an image of a test program I built for just that purpose. Can you please post the code so we can see what's in the other cases? Quote Link to comment
rpursley Posted July 15, 2007 Report Share Posted July 15, 2007 QUOTE(crelf @ Jul 13 2007, 08:38 PM) Can you please post the code so we can see what's in the other cases? Here is the code. The other case is where I would put the code to process the button data, so the vi doesn't contribute too much more than the image did. Quote Link to comment
crelf Posted July 15, 2007 Report Share Posted July 15, 2007 QUOTE(rpursley @ Jul 14 2007, 12:50 PM) ...the vi doesn't contribute too much more than the image did. :thumbup: Thanks! I know it's only a bit more info, but I think it was important to round it out, especially when people search the forums for it. Quote Link to comment
TomW Posted August 17, 2007 Report Share Posted August 17, 2007 Hi All- This might be a good application for using a change detection signal event. What type of hardware are you using? If you are using a plugin M Series or an industrial DIO board that supports change detection you can use the example I posted here. The only other requirements are that you use LabVIEW 8.0 (or later) and NI-DAQmx 8.0 (or later) Hopefully this helps- Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.