02-17-2012 07:07 PM
Hello,
I recently started programming again with LabView (after a 7 year hiatus). I am trying to write a program to control a syringe pump. However, to make a long story short, right now I am using a program called KernelPro to virtually create a pair of serial ports connected via a virtual null modem cable. My LabView (version 2011) program can write a string to one port (COM 1) and read the same string from the other port (COM 2). I assume this means that once I hook up the pump, I will be able to communicate properly with it.
Commands will need to be sent to the pump to do things. For example, "Move down to postion 10. Then dispense. Then retract. Repeat this 5 times". Currently, my program can do this (via an assortment of letters and numbers sent in a string to the motor). I envison that the program would roughly work as follows:
1. User inputs the desired parameters.
2. User clicks "Do this"
3. Software sends command to pump.
4. <Idle>
5. User inputs new parameters...
6. Repeat 2-5.
Right now, I have a boolean LED ("send command") which activates a T/F case structure. Inside the structure, the serial ports are initialized, and one serial port is sent the command which is read by the second, and the string is then shown to the user via an indicator on the front panel. Again, as this is a virtual null-modem, the input and output strings are identical.
When running the program in continuous mode, as long as the boolean LED is toggled true, any changes in the commands are sent to the serial ports in real-time (and I can see that it is being read correctly in real time). However, I don't think that I want this to be the case. Referring to my steps above, steps 1-3 work fine, but there seems to be no step 4, and step 5 goes instantly to step 3, skipping step 1 and 2.
I think I need something like a one-time-use switch, which will send a command but then reset itself to the "off" postion. Of course, my program as written should work (I think!), but the user would have to manually turn off the "Do this" switch after turning it on.
Is there a switch that can do this automatically? I tried While loops, and looked into shift registers, but nothing seemed to work for me. Again, I just started using LabView again, so I don't remember much!
Any help would be appreciated. Thanks in advance!
-B
02-17-2012 07:32 PM
B, welcome to the forum.
Usually, it is helpful to post the VI you are describing, or a dumbed-down version of it (with dummy sequence structures instead of irrelevant subVIs, for instance).
Anyhow, what do you mean by running in continuous mode? Do you mean after cliking on the "Run Continuously" button? That's not necessarily the best approach, as you will need to abort your program to stop it. It's is better to put your code within a while loop, which you will stop with... a stop button as in:
Second, booleans have different types of behavior, which you can choose by right-clicking on them and looking for Mechanical Action.
You want to use "Latch When Released" in your case.
02-17-2012 07:59 PM
Since you are new to LabVIEW, and you don't seem to know about the different mechanical actions of boolean controls.
Then I would recommend looking at the online LabVIEW tutorials
LabVIEW Introduction Course - Three Hours
LabVIEW Introduction Course - Six Hours
02-17-2012 07:59 PM
02-20-2012 11:28 AM
Thanks for your replies. I'll check it out. The mechanical toggle seems to be exactly what I would be looking for.
I was clicking "run continuously", but had also tried running it in a While loop w/ a stop button. I'll stick to that approach from now on.
Now, off to make the program work!