LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Elapsed time with VISA Read

In my VI inside case structure, I am using VISA read with 10 sec timeout, In the mean tiime I also want user to show total number of second elapsed waiting for read by VISA.  

In my application after user scans the serial number than user need to connect ECU within 10 seconds(VISA timeout). In the mean time I need to show user this message 

Connect ECU in 10 sec.

Connect ECU in 9 sec.

Connect ECU in 8 sec.

Connect ECU in 7 sec.

 

Thatswhy I need elapsed time or any other method is welcome. Attached VI for reference. 

 

 

 

 

--------------------------------------------------------------------------------------------------------
Kudos are always welcome if you got solution to some extent.

I need my difficulties because they are necessary to enjoy my success.
--Ranjeet
0 Kudos
Message 1 of 9
(3,298 Views)

Two possibilities.

 

Make the timeout 1 second, and put the VISA read in a For Loop that runs 10 times.  Code to update string in there, and if the VISA read does not timeout, then it ends the For Loop early.

 

Another, separate while loop adjacent to the VISA read that updates the string display.  Where the VISA read, have it set an occurrence that tells the while loop to stop.

0 Kudos
Message 2 of 9
(3,280 Views)

@RavensFan wrote:

Two possibilities.

 

Make the timeout 1 second, and put the VISA read in a For Loop that runs 10 times.  Code to update string in there, and if the VISA read does not timeout, then it ends the For Loop early.

 

Another, separate while loop adjacent to the VISA read that updates the string display.  Where the VISA read, have it set an occurrence that tells the while loop to stop.


 

Thanks for the quick reply.

 

For the first, I think I shouldnt go for VISA read in loop becasue that might lead to data loss. If I use while loop then its incrementing after VISA read. Both are not running parallely. I think for that also I need to use while loop wisely for VISA read too.

 

--------------------------------------------------------------------------------------------------------
Kudos are always welcome if you got solution to some extent.

I need my difficulties because they are necessary to enjoy my success.
--Ranjeet
0 Kudos
Message 3 of 9
(3,276 Views)
How do you think a read inside a loop is going to lose data and why on earth would you start a loop after instead of in parallel?
0 Kudos
Message 4 of 9
(3,256 Views)

Its all about timing and it is independent of PC. I mean to say if I normally use VISA then it will wait untill all data or termination char is matched and hence sure that data cant missed. If on other PC timining didnt matched then data might lost.

 

I know it wont but might possible

--------------------------------------------------------------------------------------------------------
Kudos are always welcome if you got solution to some extent.

I need my difficulties because they are necessary to enjoy my success.
--Ranjeet
0 Kudos
Message 5 of 9
(3,252 Views)
I think I don't understand what you just said.
0 Kudos
Message 6 of 9
(3,246 Views)

you see if I dont use loop then VISA read will wait untill complete or termination char is met. If I use loop than might posible that becasue of timing mismatch data lost.

 

without loop VISA polls the data continous sure that data will not lost

 

--------------------------------------------------------------------------------------------------------
Kudos are always welcome if you got solution to some extent.

I need my difficulties because they are necessary to enjoy my success.
--Ranjeet
0 Kudos
Message 7 of 9
(3,234 Views)
You'll only lose data if you decide to discard some.
0 Kudos
Message 8 of 9
(3,228 Views)

No I will not do that intentionally Smiley Very Happy.

 

So you suggest reading in while loop. Let me try that also.

--------------------------------------------------------------------------------------------------------
Kudos are always welcome if you got solution to some extent.

I need my difficulties because they are necessary to enjoy my success.
--Ranjeet
0 Kudos
Message 9 of 9
(3,225 Views)