LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to create a stop button to send commands through serial port and end labview vi?

Solved!
Go to solution
Thanks again cory, I cannot open that file right now, but if is a quick fix can you tell me what i need to do exactly. The "i" simply runs the for loop for as many times as it it is supposed to, how can I change the number counter to a different format so the string goes 00RUN, 01RUN, when it counts up? It keeps defaulting 00  back to 0
0 Kudos
Message 21 of 43
(1,888 Views)
Actually, the Number to Decimal String will not pad the string with '0'. The Format Into String will though, and should be used to replace the Number to Decimal String and the Concantanate String function.
Message 22 of 43
(1,884 Views)

superomario wrote:
...I cannot open that file right now...
Oh yeh haha you just told me yesterday you have 7.0, my memory isnt that great Smiley Very Happy
 Put the following code in the True case of your case structure:
untitled.PNG 

 

Message Edited by Cory K on 06-03-2010 10:07 AM
Cory K
0 Kudos
Message 23 of 43
(1,882 Views)

Dennis Knutson wrote:
Actually, the Number to Decimal String will not pad the string with '0'. The Format Into String will though, and should be used to replace the Number to Decimal String and the Concantanate String function.
My mistake, you are right. I should have ran the code before I posted it.
This will correctly create 00, 01, 02 as Dennis described
format string.PNG 

 

Cory K
Message 24 of 43
(1,868 Views)
I had actually already done that to make the other pumps stop too, but the address still comes out wrong. I can make it work the bad way by writing all my commands as 0RUN, 0RAT and setting the addresses to 00 10 and 20 but that is too confusing for someone who just wants to use the program or add more pumps at their leisure.  And if i want to make a selection option in the future for the units say milliliters instead of microliters I think it is better to have the commands as just commands and not #command format
0 Kudos
Message 25 of 43
(1,862 Views)

Dennis Knutson wrote:
Actually, the Number to Decimal String will not pad the string with '0'. The Format Into String will though, and should be used to replace the Number to Decimal String and the Concantanate String function.
My mistake, you are right. I should have ran the code before I posted it.
This will correctly create 00, 01, 02 as Dennis described
format string.PNG 

 

 
Where does the command input go in this? 
0 Kudos
Message 26 of 43
(1,859 Views)

The output of this function will be 00, 01, and then 02 for each of the 3 iterations.

You will put this in the top input of your 'concatenate strings' function in place of where I had the 'number to decimal string' function before. 

Cory K
Message 27 of 43
(1,857 Views)
One final question regarding stopping all the pumps. When i run it in highlight execution mode all the pumps get the command and stop. BUt when i run it normally only the firt pump stops. So i put in a 10s time delay between the program stop and the case structure to give it enough time to send all the commands but that wasnt enough. how can 10sec not be enough? when it updates the rates instantly when i change the dial...
0 Kudos
Message 28 of 43
(1,839 Views)

Are you sure you put a 10 second delay?

If you did this

wait.PNG

You only made it wait 10 ms (0.01 seconds).

The wait function is in terms of milliseconds 

 

Try somewhere between 100 - 250 ms. 

Cory K
0 Kudos
Message 29 of 43
(1,830 Views)

The for loop with the VISA writes which Cory posted has a VISA Close inside the loop.  It closes the VISA session on the first iteration.  Thus, the VISA reference will be invalid on the second and third iterations and no writes will occur.  Move the VISA close to outside the loop.

 

Lynn 

Message 30 of 43
(1,829 Views)