Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Delay with serial read

I have included a section of code I am working on.  Basically, I have two control buttons that the user can click on to select to either run an automated test on the load machine or run a manual test and I set up an event structure to handle these options.  When I run the program and click on manual, the program jumps right into the while loop like it is supposed to and begins recording data.  However, when I click on Automatic the program sends the command to start the automatic test sequence and the machine begins running like it is supposed to, but there is something like a 15 second delay before the program goes into the while loop and begins recording data.  Any ideas as to why there is such a big delay and what I need to do to fix it?
0 Kudos
Message 1 of 13
(4,394 Views)
I don't understand how the event structure in your program ever works unless you are not showing a big part of the program. You don't have it inside a while loop. that means it can't respond to user events. Maybe if you attached the actual program instead?
0 Kudos
Message 2 of 13
(4,383 Views)
it works, the event structure only needs to work for 1 value change and then go into the while loop that contains the rest of the program, which it does correctly when I click manual but delays like 15 seconds when I click on automatic.  what do i have to do to attach the entire program?
0 Kudos
Message 3 of 13
(4,379 Views)
Look below the message body. See the 'Attachment' box? Click the browse button.
0 Kudos
Message 4 of 13
(4,378 Views)
It would at least be interesting to see the code in the other event. Two ideas :
  1. Change the timeout for the serial port and check if it has an effect on the delay. If yes, then the delay is related to the Write or the Flush of the serial port.
  2. Add some code to locate the source of the delay. See attached picture.

0 Kudos
Message 5 of 13
(4,367 Views)
...sorry I should have clarified, how do I go about attaching just the VI, all I can find is the project file, can I just attach that like so?
0 Kudos
Message 6 of 13
(4,368 Views)
and for the other event (manual) I just wire the VISA name and error out stuff through into the while loop.
0 Kudos
Message 7 of 13
(4,362 Views)
No, this is only the configuration of your project ! We need the VI.

If you shouldn't know the directory of the VI >> Open the VI >> press CTRL+I >> Select General for the Category >> the directory is displayed

Attach the VI in the same way you did with Basic Serial Write and Read.lvproj.

0 Kudos
Message 8 of 13
(4,359 Views)
Please do above mentionned points to locate the source of the delay. I assume this is related to the hardware.
0 Kudos
Message 9 of 13
(4,358 Views)
0 Kudos
Message 10 of 13
(4,355 Views)