01-12-2012 07:29 AM - edited 01-12-2012 07:36 AM
@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.
01-12-2012 11:05 AM
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.
01-12-2012 11:09 AM - edited 01-12-2012 11:10 AM
Try a delay before writing, like this [Edit: Adjust the 100mS delay if necessary]
The reason I asked about if you are pressing run continuously is because you said the ^Q is being repetadly sent.
01-12-2012 11:57 AM
The delay does not make a difference in the output.
01-12-2012 12:16 PM
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
01-12-2012 12:27 PM
Post your VI so we can have a look.
01-12-2012 12:31 PM
Attached.
01-12-2012 12:39 PM
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.
01-12-2012 04:41 PM
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.
01-12-2012 07:22 PM
Can you down-convert your VI to LV10?