03-22-2010 09:17 AM
Hi all,
Using the Change Detection Event method, I am picking up when a operator controlled limit switch is activated. I then use this event to run a sub-vi that essentially imitates the <Enter> key on the keyboard. This is so that during operation, I don't have to have a keyboard on the test bench.
Problem is, a single hit on the limit switch generates upwards of 5 or 6 Change Events that then run the sub vi that simulates the enter key multiple times. This causes the application to jump through dialogs and casues the app to not work correctly.
I have made adjustments to the options on the DAQ mx Change Detection vi to no avail. I have also played with the timing in the User Events case but it doesn't help. Even setting a 2 second delay in the code allows multiple 'hits' on the change detection. I have two DAQ mx Read vi's in the code thinking that the Change Detection was pickinig up both the engage and disengage of the limit switch.
I have attached a pdf of the block diagram for the Change Detection vi and the Capture User Events case that uses it, the vi that creates the event code and the vi that simulates the keyboard.
If anyone has input on how to better control the Change Detect funtion or even an alternate method of getting a keyboard input from hitting a limit switch, I am all ears.
Thanks
Doug
03-24-2010 06:54 PM - edited 03-24-2010 06:54 PM
Hello,
In some cases, Debounce/Settling Time when using switches may appear as extra pulses close to the actual transition of a digital signal, and can cause erroneous readings. I would recommend trying digital filtering on your M-Series card using the following values for the minimum digital pulse widths 0s, 2.56ms, 6.425us and 125ns to filter out the debounce. I have included an example showing how to use a dummy counter to enable digital filtering on the M-Series PFI lines (see link 1), and incorporating a digital input, sample clock and register events (as a workaround for Change Detection).
1. Using a Dummy Counter to Enable Digital Filtering on M Series PFI Lines: http://decibel.ni.com/content/docs/DOC-9493
Regards,
Ali M
Applications Engineer
National Instruments