LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

VISA Write sends continuously


@Ravens Fan wrote:

@MoReese wrote:

Also, your wait may not provide you proper timing.  Your Visa read could execute first, which I assume is not what you want.


That is probably not a problem the way the VI is written.  It won't matter if the VISA read begins executing right away.  The VISA read will finish when one of 3 things happen:

1.  The termination character is received (though in this situation, that is not going to occur since the serial config was set to disable the termination character.)

2.  The number of bytes requested is received.  So here once 64 bytes come in.

3.  The timeout occurs.  Here it is set for 10 seconds.

 

So whether the wait occurs before the 64 bytes are in, during, or after, it doesn't matter, as the VISA read will wait until event #2 or #3 occurs.


Yes, you are correct.  Thanks for clarifying.

 


If the reading of the bytes at port occurrs right away, you may not have given yourself enough time for any bytes to have arrived.

This is why I recommended he change his while loop.

-----------------------------------------------------------------------------------------
Reese, (former CLAD, future CLD)

Some people call me the Space Cowboy!
Some call me the gangster of love.
Some people call me MoReese!
...I'm right here baby, right here, right here, right here at home
0 Kudos
Message 11 of 32
(1,315 Views)

Thanks for all the replies. 

 

MoReese, the VI hangs when it gets to the VISA Write function and outputs an error code as follows:

Error -1073807298 occurred at VISA Write in serial1.vi

Possible reason(s):

VISA:  (Hex 0xBFFF003E) Could not perform operation because of I/O error.

The string is appearing in HyperTerminal so it doesn't appear to be an output error.

I'm aware that the wait 1s bit isn't the best, but the VI is far from complete and I just needed something quick and dirty for testing purposes.

 

rayclout, I don't think the command requires a carriage return; the instrument manual doesn't specify but does say that pressing Ctrl+Q when connected will send the command.

 

Raven, I changed the string to hex code 11; the output updated accordingly in Hyperterminal to display these: ◄  but is still sending them as fast as possible.  Thanks for the catch, though, that would have come back to bite me later.

 

Steve Chandler, it is a subVI that will be called from another program.  I've switched between T/F on the While conditional; the outcome is the same as the error occurs before the program reaches the loop.

 

I appreciate the help so far, but I can assure you that the issue is not within the While loop.  I can delete everything except the VISA initialise and write and still receive the same error.

0 Kudos
Message 12 of 32
(1,301 Views)

Try a delay before writing, like this [Edit: Adjust the 100mS delay if necessary]

 

Example_VI_BD.png

 

The reason I asked about if you are pressing run continuously is because you said the ^Q is being repetadly sent.

=====================
LabVIEW 2012


0 Kudos
Message 13 of 32
(1,300 Views)

The delay does not make a difference in the output.

0 Kudos
Message 14 of 32
(1,296 Views)

I didn't think it would but thought it was worth a try. I did find a document on this particular error. http://digital.ni.com/public.nsf/allkb/60DDFED7EFEFE7188625705700750821?OpenDocument

=====================
LabVIEW 2012


0 Kudos
Message 15 of 32
(1,293 Views)

Post your VI so we can have a look.

-----------------------------------------------------------------------------------------
Reese, (former CLAD, future CLD)

Some people call me the Space Cowboy!
Some call me the gangster of love.
Some people call me MoReese!
...I'm right here baby, right here, right here, right here at home
0 Kudos
Message 16 of 32
(1,290 Views)
0 Kudos
Message 17 of 32
(1,287 Views)

What I really don't understand is that the CTRL-Q is being sent over and over. Do you mean when you run this subVI by itself it sends the character over and over or when you run the calling VI? If it is sending over and over running this VI by itself I would suspect a very strange hardware issue. Then again you said you are testing with some kind of virtual COM port.

=====================
LabVIEW 2012


0 Kudos
Message 18 of 32
(1,280 Views)

It's just running from this subVI for now.  I may have an opportunity tomorrow to test with the actual device rather than the virtual COM port, hopefully that turns out to be the issue.

0 Kudos
Message 19 of 32
(1,266 Views)

Can you down-convert your VI to LV10?

-----------------------------------------------------------------------------------------
Reese, (former CLAD, future CLD)

Some people call me the Space Cowboy!
Some call me the gangster of love.
Some people call me MoReese!
...I'm right here baby, right here, right here, right here at home
0 Kudos
Message 20 of 32
(1,255 Views)