05-16-2013 03:19 AM
Hello,
My collegue and I are trying to make a program in Labview 2012 that starts a timer when the first trigger(sensor) is hit and stops the timer when the second trigger(sensor) is hit. We currently have a program for it, but this program was not accurate enough. Also the current program is using the DAQ assistant, but we would like to replace this with daqmx triggering. We also tried to use the OnboardClock on the PCI 6132, but still could not make the program work.
Is there someone that knows how to do this and could explain it?
(In the attachment is the current program)
Thanks in advance,
Tommy van Geest
Solved! Go to Solution.
05-17-2013 05:01 AM - edited 05-17-2013 05:01 AM
Hello Tommy,
There are some things in your explanation that are unclear to me:
- What do you mean with "when the first/second trigger is hit"?
- What kind of trigger/sensor/signal is this?
- Do you want to have something that continuously updates how much time has passed?
Better said: Do you want to see the timer being continuously updated after the first trigger to know at which point you currently are?
- Or do you rather want something that only shows how much time was in between after both triggers have passed?
05-17-2013 06:22 AM
Thank you for your reply,
What I mean by 'the trigger is hit' is that we use 2 buttons(hardware), when the first button is pressed, it needs to start the timer and when the second button is pressed, it needs to stop the timer, this should show the time in between the pressing of the buttons.
I indeed only want to see the time that was in between both triggers.
I hope this cleared it up a bit
- Tommy van Geest
05-17-2013 08:11 AM - edited 05-17-2013 08:12 AM
Hello Tommy,
It cleared up a big part, but there are still some uncertainties.. 🙂
Are you connecting it to the digital inputs or the analog inputs?
What kind of voltages do these buttons "produce"/give?
Is there a need to do debouncing on these buttons or is it done in the "buttons" itself?
Just to be sure:
You're talking about real physically available buttons and not buttons on the front panel, right?
05-17-2013 08:59 AM - edited 05-17-2013 09:00 AM
Hello Thierry,
Thank you for the quick reply to my question
The buttons are connected to Digital inputs, they produce a signal of 5 Volts.
I don't quite get what you mean by 'debouncing', do you mean if the buttons are latched or switch toggled?
These buttons are indeed physically by using the BNC 2110 connector.
- Tommy
05-23-2013 06:50 AM - edited 05-23-2013 06:51 AM
Hello Tommy,
Normally what I would advise people to do is use the Two Edge Seperation functionality in DAQmx.
However, with your specific card (and related counter STC-chipset) this is not directly supported.
One work around would be the following one:
http://zone.ni.com/devzone/cda/epd/p/id/3501
Basically you will have one counter that generates a pulse train when the first signal goes high.
The a second counter will measure the pulse train generated by the first counter until the second signal goes high.
More explanation an be found in the linked document.
Please let us know if this resolves your issue.
With debouncing of buttons I actually mean the following (this is just the first item I found while googling the terms "debounce button"):
http://www.engscope.com/pic-example-codes/basic-io-button-debounce/
05-24-2013 05:48 AM
Hello Thierry,
The link you sent helped out a lot
Currently the first trigger works perfectly and starts a counter, the only problem is that the second trigger only pauses the timing, I cant seem to make it stop the counter. ( The program is for a machine that drops a weight down, and it needs to measure the time in between the 2 sensors (buttons in test setup), so it starts counting at the first sensor and stops counting at the second sensor for an accurate measure between the 2 sensors )
Any idea how I can make the counter stop instead of pause? I cannot seem to find a feature in Daqmx that does this.
Thanks in advance,
- Tommy
05-24-2013 06:14 AM
Hello Tommy,
Can you share your current code?
05-24-2013 06:30 AM
Hello Thierry,
Here is the current code, I didn't change much of the code in the link that you sent earlier.
I changed the controls to constants, so you only see the time on the front panel.
Kind regards,
- Tommy
05-31-2013 06:02 AM
Hello Thierry,
The program finally works the way I want, I want to thank you a lot for your help, kudos to you!
I will include my program, so other developers can use it if they need it.
Kind regards and thanks again,
- Tommy