06-08-2014 09:40 PM - edited 06-08-2014 09:51 PM
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.
06-08-2014 10:37 PM
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.
06-08-2014 10:48 PM
@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.
06-08-2014 11:23 PM
06-08-2014 11:32 PM
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
06-08-2014 11:41 PM
06-08-2014 11:48 PM - edited 06-08-2014 11:49 PM
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
06-09-2014 12:02 AM
06-09-2014 12:03 AM - edited 06-09-2014 12:04 AM
No I will not do that intentionally .
So you suggest reading in while loop. Let me try that also.