LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

waituntil alternative in LabVIEW

Hi all ,
 
 
I want to make a small LabVIEW program , that  waitsuntil an ASCII character  "A" is reciived by the serial port , and then executes the program, how could I do this application or in other words what is the LabVIEW alterantive for " Waituntil " command
 
Thanks
 
 
Maple
0 Kudos
Message 1 of 29
(4,443 Views)

It would just be a while loop with a VISA Read as in the attachment. You probably also want that if the timeout occured by whatever time you use with the elapsed time function, an error would be set. 

Message Edited by Dennis Knutson on 01-15-2007 04:45 PM

Message 2 of 29
(4,424 Views)
Thanks alot for the answer, I found the icon " VISA wait on event " will this do the job also , Thanks again
0 Kudos
Message 3 of 29
(4,411 Views)
Dear Dennis
 
 
Thanks for your help I have labled for you an icon in the example you gave me in LabVIEW that I dont get it , could you please tell me about this VI or Icon what does it do , attached is your example with the icon being Labeled
 
 
Thanks
0 Kudos
Message 4 of 29
(4,407 Views)

VISA Wait on Event will only wait for any serial character - not a specific one like you asked for.

The function you ask about is the compound arithmetic set to OR mode.

Message 5 of 29
(4,399 Views)

I want to do the following protocol

 

I am  establishing a communication link between the PC and an external device using the serial port , PC has a LabVIEW program  ( that is capable of  serial port communication ) , the external device has its own program that can do serial port communication .

 

 I want sort of hand shake protocol between the Pc and the external device using ASCII character notification from the serial port, I will power up the external device and execute its program, THEN I will execute the LabVIEW program,   the external device program will wait until a serial port character "A" is received then it will send a "B", THEN I will execute the PC program (LabVIEW), both The PC and the External device have RS232 connections in it and both are joined together with the RS232 serial port.

 

 

I want this program to start by sending an "A" to the external device (which is waiting until it receives an "A"), when it receives it will send a "B" in return to the PC (the LabVIEW program of the PC must wait until it receives the "B" character), when it receives the "B" character it starts doing some operations, these operations are only started when the PC is notified that it has Received a "B"

 

I want a LabVIEW program that will always check the serial port or "READ" it and see if it has recived a "B" and when the "B" has been received it will  do the operations .

 

Dennis Thanks a lot for you help , how can I do a program in LabVIEW that waits until not for a  certain period of time and when the certain serial character is recived say "B" an certain operation will be performed

 

Thanks

maple

0 Kudos
Message 6 of 29
(4,372 Views)
The example I posted will do what you want except for the write portion. After the serial port init, just add a VISA Write and send the 'A. The while loop will then wait for the 'B' character. You could also put the Write inside the loop and continuously send it and then do a read.
 
Since there is an error out connection from the while loop, put whatever code you want after the while loop and just connect the error clusters.
Message 7 of 29
(4,367 Views)

Thanks alot Dennis,

 

My question is How could I make the wait for an unlimted period of time ? is this dobale in LabVIEW program

 

 

Thanks

 

 

0 Kudos
Message 8 of 29
(4,356 Views)

sorry I mean doable

 

Wadah

0 Kudos
Message 9 of 29
(4,349 Views)
I see your problem with a read from serial port inside a while loop while there is nothing to be read back and time out error occurs. Here is the way to force it to read until there is something in the buffer. Also be sure to always flush out the buffer after initializing itSmiley Tongue. But if the external device always responds with a B (slowest time may be in a few milliseconds) right after a write to it then actually there is no need to force it. The best way is understand your device well enough to communicate with it effectively through the serial port.
 
Have funSmiley Wink
Message 10 of 29
(4,339 Views)