LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 
Reply

Automated Switching between 0 and 1

Hi,

 

Anyone know how to inter switch my output between 0 and 1 simulataneously? For example, high speed frequency switching to make two pointers seem working simulataneously. 

 

 

Best Regards,

Scott

0 Kudos
Message 1 of 8
(737 Views)

Again, please provide some details.  Something that gives us a clue as to what you are trying to do.  What is your output?  What two pointers are you talking about?

 

Even attach a VI so we can see what you've done so far.

0 Kudos
Message 2 of 8
(731 Views)

Hi Ravens,

 

My bad. I working on optical trapping simulataneously. I am trying to implement high frequency switching so that it seems that I am able to control 2 controls at the same time. The controls are cursors which the laser will be shoot out to trap the particles. My attachment is as follows. I am thinking to create a control to switch between my case 1 and 0 in the case strucutre in the attachment shown. As this case structure is critical in setting the control to be used for the remaining parts of the project. Thanks for your feedback! 

 

Best Regards,

Scott

0 Kudos
Message 3 of 8
(726 Views)

I would turn case 0 and 1 into True and False.  Have your case structure driven by a boolean instead of a number.  Put the boolean into a shift register and use the Not function to flip between the True and False case.

 

You could still use a number.  Just do a 1 minus the current value to drive the case structure and put it in the shift register.  Every iteration 0 will become 1, or 1 will become 0.

0 Kudos
Message 4 of 8
(718 Views)

Hi Ravens,

 

Thank you for your reply. It works well. However, i realize as my processor speed is moving at high speed. This high speed switching is too fast that before my case 0 work is done, it is already switch to case 1 hence both cases are not done as the speed is too fast that the programme does not register the change. Is it possible for me to add in a timer so that the switching only changes every 10 iteration of a while loop? I saw this Vi named watchdog timer but not sure if this was the right one though. 

 

 

Best Regards,

Scott

0 Kudos
Message 5 of 8
(684 Views)

Sena_Scott wrote:Thank you for your reply. It works well. However, i realize as my processor speed is moving at high speed. This high speed switching is too fast that before my case 0 work is done, it is already switch to case 1 hence both cases are not done as the speed is too fast that the programme does not register the change. Is it possible for me to add in a timer so that the switching only changes every 10 iteration of a while loop? I saw this Vi named watchdog timer but not sure if this was the right one though. 

That sounds like you have a race condition.  Writing to a local variable?  If so, you might want to use a queue instead.

 

Yes, you could keep a counter.  I do that all the time.  Just store it in a shift register.  Each iteration you increment and use the Quotient & Remainder function to get the remainder of the counter and the number of iterations you want.  Then do a comparison with 0.


There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
Message 6 of 8
(656 Views)

Add a 'wait until next ms multiple' into your loop to slow it down.

0 Kudos
Message 7 of 8
(654 Views)

With these kinds of questions, you must be very new to LabVIEW.  Have you had any training or taken a tutorial?

 

I would recommend looking at the online LabVIEW tutorials
LabVIEW Introduction Course - Three Hours
LabVIEW Introduction Course - Six Hours

Message 8 of 8
(629 Views)