02-10-2010 11:55 AM
Hello,
Take a look again at the example that I originally posted which demonstrates how to use a queue. There is a note there explaining where the data type is set. The data type of your x position is a DBL which means that is what you should set the data type of the queue as. Also notice that in your current configuration, there is a red dot on the input terminal of the enqueue element. This red dot means that LabVIEW is casting the data types in order to make them match. Thus, when you dequeue the element, it is in the default data type that you originally set. You would either need to cast that data back to DBL or set your queue for DBL data types in the beginning.
-Zach
02-10-2010 07:25 PM
i hey,iZACHdx,
I didn't realize I can put the terminal of data type. I just try to create constant/control at data type input of Obtain Queue. So, I cannot wire them.
Right now, I put DBL at input of Obtain Queue. It works. the red dot is still there. Anyway, is this right ?
Also, Do I really need set time wait, which likes the example you posted?
Thank you very much!
02-11-2010 09:41 AM
Hello,
If you turn on context help by clicking Help»Show Context Help, you can hover your mouse over a wire to determine its data type. I would check the data types of the wires in order to make sure you are setting the properly to avoid casting. The example that I posted has a wait in the loop to control the execution speed. If it was not there, the loop would run extremely fast which was not the effect that I wanted when generating a random number with every iteration. For you, this would not be necessary.
-Zach
02-11-2010 11:13 AM
hey,
Understand. I try what you said. Position x is SGL. So, I put SGL at input of Obtain Queue. there are still red dot. maybe they need convert.
I think that's fine. If I did like last screenshot, it's right?
Thank you!
Guangli
02-12-2010 09:15 AM
Hello,
Yes, things look ok as long as your loop isn't held up by anything else. The red dot shouldn't be there if all the data types match, but casting between different numeric types should be ok.
-Zach
02-23-2010 10:11 AM
Hi, iZACHdx,
I'm back. I was so busy in last two weeks that I cannot run the program. Yesterday, I try to use it to control my project.
The motor doesn't move. And the image acquire loop cannot run continuously. I'm not sure how the queue effect the program. it shouldn't change the original structure, right? It should transform or swithc between two loop automatically, right? Please feel free to take a look!
Thank you very much!
Guangli
02-25-2010 08:21 AM
Hi Guangli,
If all that you've added to your program is the queue, it shouldn't cause it to run slower or not at all. Have you tried running your program in highlighted execution to see where it might be getting hung up? Or better yet, place some probes in your program to see what values are being queued and dequeued to make sure the motor portion is getting non-zero values.