|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
Event listening for a counter.
Hey.
I read for the past few days about interrupts, events and counters. All I want to do is hook an interrupt\event to a counter, so that a certain VI is called the moment the counter's value changes? Is this even possible? Thanks Itamar. |
|
#2
|
||||||
|
||||||
|
Re: Event listening for a counter.
There are probably a lot more efficient ways to do what you want. What is the high level task you are trying to accomplish?
|
|
#3
|
||||
|
||||
|
Re: Event listening for a counter.
more efficient?
I don't believe explaining the algorithm is neccessery right now. Basically, I would like to stop a motor from running the moment a microswitch is clicked. This is normally a very easy task to accomplish, but my code has many other VIs to run and take care of, so I wanted to try using events of interrupts. So this is not really about efficiency, it's more about how much time it takes for the motor to stop, and I believe that by using an event the response would be immediate. |
|
#4
|
|||
|
|||
|
Re: Event listening for a counter.
Using a limit switch input on a Jaguar is probably the fastest way to stop a motor.
-Joe |
|
#5
|
||||
|
||||
|
Re: Event listening for a counter.
Quote:
And yes, if your switch is normally closed, wiring it straight up to the jaguars is much easier (and safer!) assuming you don't ever want to go past the limit switch (it is limiting...) |
|
#6
|
||||
|
||||
|
Re: Event listening for a counter.
After reading your post I tried using parallel loops and it works better, but I still can't shake the feeling it would work much better if I used events.
Interrupts and events are used all the time. are you telling me it is impossible to perform in LabVIEW? Doesn't make much sense. |
|
#7
|
|||
|
|||
|
Re: Event listening for a counter.
Quote:
If for some reason you are opposed to that solution, you can use the interrupt palette in LabVIEW to connect an interrupt directly to the digital input that your switch is connected to. You then put a separate parallel loop waiting for the interrupt to occur. Then do what you need to when it stops waiting. There is an example for how to use interrupts in LabVIEW. Look at that first. -Joe |
|
#8
|
|||||
|
|||||
|
Re: Event listening for a counter.
The LabVIEW interrupt vi palette is at:
WPI Robotics Library -> Utilities -> Interrupts |
|
#9
|
||||
|
||||
|
Re: Event listening for a counter.
I managed to use the Interrupt vis, but came across a problem.
My algorithm is consisted of two digital inputs, each performs half of the process. Firstly I used an interrupt to have immediate responses to the first digial input. it worked great. but when I added a second interrupt for the second digital input, not only that the new interrupt didn't work, it stopped the old one from working. Any ideas what could cause this? Is there an interrupt-limit I'm not aware of? |
|
#10
|
|||
|
|||
|
Re: Event listening for a counter.
There is a limit of 8 interrupt inputs.
Perhaps you are putting the wait for both of your inputs in the same loop. If you do that you are waiting for both inputs, not one or the other. -Joe |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|