05-03-2010 11:17 AM
Hi Guys,
this is my first LabView project so I think there might be definitively a way to improve this program.
Here's what I want to do: I need a program that controls our laser shutter by opening and closing it for a some specific milliseconds and repeats this sequence so and so many times. The shutter itself needs continuous "1"s or zeros.
Right now I implemented the opening/closing time sequence with a case structure and the "wait" command. Unfortunately the # of repetitions does not work because the "counter" does not start with zero after one sequence is done. For example: I need 4 repetitions, the counter will execute the case structure 4 times; after this I need 5 more reps but the counter will still have the number 4 in memory and therefore only opens the shutter once (4->5).
I tried to circumvent this problem bei using a division an then only check the remainer of the calculation but then I get in trouble if the numbers of repetition have a common denominator.
However I came to the conclusion that there must be a much better way to do this 🙂 . Actually this is a very easy task ?! 😞
Also I would like to add a timer to check how much of the waiting time already passed. This can be very handy if you have i.e. an opening time of 3 minutes. Is it possible to directly connect something the the "wait button" to give out the time?
Thanks a lot for every single hint 🙂
05-03-2010 11:45 AM
Using a Quotient & Remainder function into the selector terminal should work. Set y = Number of cases + 1.
But, seeing that it doesn't work, try using a Select to reset the count when the boolean changes:
05-06-2010 06:33 AM
Hi Rabyte,
Wow, you really dont like shift registers do you!!
I couldnt follow your code so i had an attempt at writing what i think you described and from what i saw your code do.
Let me know if it helps. The only difference is that the time on/off inputs are in seconds, not milliseconds. You can still get millisecond resolution but has to be in units of seconds, ie 100ms = 0.1 seconds.
Hope it helps,
Rgs,
Lucither
05-06-2010 10:49 AM
@Wow, you really dont like shift registers do you!!
Yap, basicly because I don't know how to use them 😉
I would love to check your program but unfortunately I only have LabView 8.6 and am not able to open your file.
I also thought about something..and this actually works but I needed a third case in my case loop for that to reinitialize the counter. However not very elegant. Looking forward to check your vi
By the way, the wait timer is not very precise, I would like to have sth better that also displays the elapsed time. With which of all the timing structures could this be done best?
TNX
Fabian
05-06-2010 06:39 PM
05-07-2010 05:33 AM - edited 05-07-2010 05:37 AM
Hi Rabyte,
How fast is the fastest shutter speed going to be. Im a little confused because in your first post you was talking about a 3 minute open time but on your vi i ran the open/close times where approx 10ms. Also, how accurate do these times need to be? If you are talking about times as low as 1ms and they have to be very accurate then i wouldnt recommend using a standard pc, using a standard operating system. The smallest delay that we can input to a time vi is 1ms. Also this 1ms will not necessarily be 1ms, will be thereabouts. If you are talking about times measured in seconds and the accuracy isnt that much of an issue then you wont have a problem.
There are better people then me on here to ask about this though as i have never done a project with such timing constraints. I am aware that there are pci boards by NI that can do what you want in hardware, best to ask someone else about that.
I implemented a timer that is displayed in this vi. This timer displays the time of the open or close delay. It does not display the whole time from the start of a cycle to the end, ie if you wanted 4 pulses, it displays the time of each open and close but not the time of the 4 cycles. Is this what you wanted, if not is easy to modify.
On another note, shift registers have the same functionality as the feedback nodes you where using. They basically shift the stored value to the next iteration of the loop. They are neater (i beleive) then feeback nodes and dont break the style code of data flow (going from left to right).
Let me know how you get on.
Rgs,
Lucither