LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Highlight Execution

This program is not fully done yet but the layout is pretty much done. However it only works perfectly during the highlight execution mode. When it is off, it stops at the case structure (2, 1) at the visa read. We added one wait after each visa read but after the second wait the program still gives a problem (time out error). If anyone has any suggestions for fixing this program that would be helpful. Thanks

0 Kudos
Message 1 of 27
(3,083 Views)

I think you should add a wait after the 'VISA Write' function, this gives the instrument the time to react to the write command.

 

One thing to watch out is your 'isequal?' function to end the second while loop. Since you are using floating point data, I would suggest to use U16 datatype for those elements.

 

Ton

Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
0 Kudos
Message 2 of 27
(3,069 Views)

i added a wait from a selection of 50 ms to 15 sec and it still gives out a time out error at the visa read byte 6, i'm not sure why? it is supposed to have a byte of 6 so i know that isn't a problem. any other suggestions?

thanks!

0 Kudos
Message 3 of 27
(3,033 Views)

What do you mean by "read a byte of 6"?

 

That 6 tells the VISA read to read 6 bytes.  Are you getting that many?  It actually looks like you are expecting at least 12 bytes because right after that you are doing a string subset function starting at byte 8 for a length of 4 bytes.  Byte #8 is beyond the 6 bytes you are tell the VISA Read to read.

0 Kudos
Message 4 of 27
(3,028 Views)

i put a property node and it seems that i'm receiving 0 bytes, i'm not sure why this is? :S

0 Kudos
Message 5 of 27
(3,022 Views)

Are you sure you are sending the correct data string to write?  You said things work in highlight execution mode.

 

You should try running NI-SPY with your VI in highlight mode and then in normal run mode to see if that shows you any differences in the communication.

 

Some other things that are awkward is your use of global variables and the loop iteration terminal to determine what case of your case structures to execute.  It seems like you really should have your VI set up like a state machine.

 

Also, why are your running the beginning while loop once per second and continually opening and clearing the VISA port waiting for the user to press a button?  It seems like you should only be opening the VISA port and clearing the buffer once AFTER the user hits the button.

0 Kudos
Message 6 of 27
(3,020 Views)

here are the two different NI SPY txt files, it seems like they're executed differently? 

 

Download All
0 Kudos
Message 7 of 27
(2,999 Views)

To all your writes to the instrument that you don't expect anything back, append the *OPC? command to it, then add a read after it.  This turns the command into a query where it will output a 1 to the buffer when the command is complete (OPeration Complete).  That should eliminate those kinds of timing issues.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 8 of 27
(2,989 Views)

I don't see any Serial port configuration VI in your VI.  From the NI-Spy files, it appears that it is using a default value of 2000 msec.

 

Try putting in a serial port configuraiton VI at the beginning of your VI and set the timeout value to something larger like 5000 msec.  In your highlight execution VI, the timing shows a spread of ~3.1 seconds from the VISA write to the VISA read.  Now it may just be a matter of the highlight execution taking that long for the two respective nodes to execute, but it shows you are getting data back.  In the Capture.txt, it is showing 0 seconds between the VISA write and the final return of the timeout error.  I actually find that strange because I would have thought the timeout error would have returned 2 seconds after the time the VISA read was attempted.

0 Kudos
Message 9 of 27
(2,980 Views)

i added a visa serial but still there is an error at the same spot, :S why would it run perfectly in highlight execution but not the regular execution?

0 Kudos
Message 10 of 27
(2,972 Views)