09-24-2008 07:28 PM
Hello,
I am using the NI PC6229 with a SCB-68 interface box.
I've generated a 100kHz pulse with the DAQ Assit on Dev/ctr1. Its being fed back into Dev/ctr0 and i've set up a counter manually with the DAQmx. I want to know how to reset the counter so that the intial count goes back to zero and so that I can start the counter back up with a boolean operator. I've been told that I need to put control loops around DAQmx Start, and DAQmx Stop.
The problem is I have no idea how to go about this as there in a error in/out and a task in/out into both Start and Stop DAQmx blocks. I've already tried to used a case statement but to not luck.
Please advise.
Cheers
Kamilan
Solved! Go to Solution.
09-25-2008 02:48 AM
Hello Kamilan,
every time you start the counter task, the counter starts with its initial position. So just stop the task and start the task again, if you want to reset it. I put a case structure in the while loop to reset the counter when you press the reset button.
Hope this helps.
Uli
09-26-2008 04:51 AM
hi,
thank you for the example, but could you please resave it as version 8.2
thanks
k
09-26-2008 05:34 AM - edited 09-26-2008 05:36 AM
Hello Kamilan,
I saved it for 8.0.
Uli
10-07-2008 06:39 PM
Hello,
I modified the code and it works fine. I need to store the count outside of the loop. Having trouble because the minute I hit stop, the count value reset to 3 or 4. Not sure what to do next.
Cheers
K
10-08-2008 02:12 PM
Hello Kamilan,
I ran the counter_manual_setup VI, but I didn't see a value of 3 or 4 when I stopped the VI, the counter always reset to zero. What are you going to do with the counter output data outside of the while loop? This will determine the best method to pull the count out of the loop. You can use shift registers to store the value of the count from one iteration to the next, or you can create an auto indexed data tunnel to pass the count values out of the while loop as an array.
Regards,
Wallace F.
10-08-2008 04:46 PM
Hello,
The uploaded code is what I'm using the DAQx for. At the moment, once I hit the Beacon Return 1 button, the program shuts me out and I can't hit the "Where am I" button or any other button for that matter. Is there something I am doing wrong? I'm outside of the while loop so I'm not sure.
Can you help?
Cheers
10-09-2008 02:46 PM
Hello Kamilan,
The reason that your front panel locks up when you hit the Beacon Return 1 button is because you have the event structure set up so that when the Beacon Return 1 button is pressed, the front panel is locked up until all of the code completes for that case. The event structure is also set up to lock the front panel until all of the code for the Where am I button is completed. To disable this feature of the event structure, place your cursor on the event selector label at the top of the event structure, right-click and select Edit Events Handled By This Case. At the bottom of the Edit Events dialog box, you will see a check box that says "Lock front panel until the event case for this event completes." Uncheck this box to allow you to manipulate front panel controls while the event case for that case is being processed. Do this for both cases if you see fit.
Best wishes,
Wallace F.
10-09-2008 03:05 PM
OMG Thank you for the explanation. I was going nutty looking for a solution.
I also tried using separate while loops which also worked.
I will go try unlocking the panel on Monday and send you an update. Thanks 🙂
Kamilan
10-09-2008 03:06 PM
Hello Kamilan,
there are some things I can point you to, but I think I won't be a big help.
- Your event structure executes only once. To handle another event the outer while loop has to go to the next iteration. This can only happen when the middle while loop stops, but then the outer loop stops too.
It is not that easy to have an event structure and a while loop in parallel. Take a look at the "producer/consumer design pattern (event)" template which ships with LabVIEW or search in the example finder for examples with the event structure.
- The event cases are configured to "Lock front panel until the event case for this event completes". I believe this is what "shuts you out", but I'm not sure.
- You do not use a timer in the middle loop. When the false case is executed all your CPU will be used to cycle through no code.
- If possible, use a wire instead of a local variable (e.g. inner loop --> data)
Uli