ni.com is currently undergoing scheduled maintenance.
Some services may be unavailable at this time. Please contact us for help or try again later.
04-13-2011 08:33 AM - edited 04-13-2011 08:35 AM
Hi Ravens,
Thanks my file path problem is solved but from last two days i am working on the current position of the motor. As you said i am using the queueing function but it is not updating the current position when it is incrementing from 0-20. On front panel it is showing on the indicator when my motor moves from current to destination position. It is just giving me the starting position that is zero and it is not saving any image at 0 position.
I am using trigger button to send command to the camera that start capturing the images. I have put my freeze. vi into the case structure and then into the for loop for taking 20 images. please guide me is it logically ok...
Note: My updated VI is attached...
Regards,
Rizi
04-13-2011 08:45 AM
I'm sorry, but now your issues are getting beyond the point where I can commit any time to helping you debug. You are going to have to use the debugging tools available to you to figure this out yourself. Things like probes on wires can show you the values of wires and the time that they last executed. Extra indicators to also monitor what data is on the wire. Highlight execution to slow down code and breakpoints to stop at points of interest.
04-13-2011 04:39 PM - edited 04-13-2011 04:40 PM
Hi,
Yes i am using debugging tools to run the program. Most of the things are going fine. but in queueing operation, queueing is going fine but it is not updating the value when i am dequeueing it to take the pictures from the camera. It is just constant start value not changing it...
One more thing you have said to me queue should be initiated and released outside the loop to avoid wasting resources but it is not possible in my case i am using event structure it do not update the value on time when i try to bring them out. it is ok or not...
Regards,
Rizi
04-13-2011 10:23 PM - edited 04-13-2011 10:26 PM
@rizi wrote:
Hi,
One more thing you have said to me queue should be initiated and released outside the loop to avoid wasting resources but it is not possible in my case i am using event structure it do not update the value on time when i try to bring them out. it is ok or not...
Regards,
Rizi
What does the event structure have to do with obtaining a queue? You put your obtain queue at the beginning of the program. You split the reference wire and run it into all loops where you need it. Pass it through all cases of the event or case structures (that way you don't have a queue reference get returned to a default empty reference.) At the end of the program, you take one of those wires and run it to the Release queue function so that it executes after your loops have stopped.
If an element is put into a queue, there is no reason I can think of that it wouldn't come out of a queue, unless you happen to release the queue before the dequeue function has a chance to get the element. And I think that is very likely to happen since you have essentially created a race condition by the way you are obtaining, enqueuing/dequeueing, and releasing a queue in every loop iteration. It is very likely that you have instances in your code that the queue no longer exists. Once all references to a queue have been released, any data that may have still been in the queue will be lost. I'm actually surprised that you aren't losing more data than you already say you are.
So if you do what I said about putting the obtain queue before your loops, and the release queue after your loops, I bet you'll find your program starts working the way it is supposed to.
If you are still unsure how to do it, look at examples for queues in the example finder, and also the Producer/Consumer architecture template you can find under the File / New... menu choice.
04-16-2011 07:57 PM
Hi,
Now a new problem have occured... My queue function is contiuously being filled by the constant 0 value i.e. my initial current position but i only want to store 20 values that are from 0-20 when my current position '0' moves to destination position '20'.How to getrid from filling queue with initial current position???
Note: VI for the related portion is attached...
Regards,
Rizi
04-16-2011 09:08 PM
Because you are enqueuing the current position on every iteration of your while loop. And it is running at least every 10 milliseconds because of the timeout wired to the event structure.
You should only enqeueue the data when you want to.
04-17-2011 12:46 AM
Yes you are right my queue is getting one value on every time out i.e. 10 ms but This is the question? that how i can avoid that...I only want to enqueue my data when my current position changes from 0-20.
Regards,
Rizi
04-17-2011 01:34 PM
You put the enqueue in a case structure that is true under whatever conditions you want to test for. In the false case, you just wire through the error and queue refnum wires.
04-21-2011 12:22 PM
Hi Ravens,
At last i succeeded in making it run, thanks for your kind guidance that helped me throught my task...
Regards,
Rizi.
04-21-2011 02:43 PM
Great! That's good to hear. I'm glad I was able to be of some help.
Good luck on your further programming tasks.