03-25-2011 01:01 PM
Hello,
I am having a trouble with the instrument drivers that I got from Newport.com. Most of the instrument drivers for controlling SMC100 use a vi file called: read_write.vi, Could any one let me know how we can modify this vi, it seems to me there is too many False default on this block diagram, is any other way that we can simplify this vi? Please see the picture and vi in attachment.
Solved! Go to Solution.
03-25-2011 01:10 PM
The VI you posted is not the VI you have pictured. Posting the top-level VI does not automagically include subVIs. I can't see the whole VI, so I don't know what's in the other frames, but all that they're doing is sending a command, and reading the serial port until they see the termination character, or until there's a timeout (the latter being, I assume, a timeout for the expected response). If the termination character is enabled and the termination character is set for the VISA session, then the VISA Read will automatically stop reading once it sees the termination character. There is also a built-in timeout for VISA. So, basically, you can replace the whole thing with a single VISA Write followed by a VISA Read.
Note: I am basing the above on only seeing part of the VI as you posted it.
03-25-2011 04:17 PM
Hello isometric,
The read_write.vi is in any of home, reset.vi.
Could you please see the attachment? This read_write.vi has too many complicated boolean loops and requences, when I run any vi code that has read_write in it, it gives an error, the error number is:-1073807298, and in error out, it says: VISA Read in read_write.vi ---. If I run the program that has read_write.vi in it for 2nd time it shows no error. So errors show up frequently in some sequences.
Could you please let me know how I can fix this error?
Thanks
03-25-2011 04:37 PM
@Salam wrote:
Hello isometric,
The read_write.vi is in any of home, reset.vi.
As I pointed out, the top-level VI does not automagically include all of the subVIs. They are separate files.
Could you please see the attachment? This read_write.vi has too many complicated boolean loops and requences, when I run any vi code that has read_write in it, it gives an error, the error number is:-1073807298, and in error out, it says: VISA Read in read_write.vi ---. If I run the program that has read_write.vi in it for 2nd time it shows no error. So errors show up frequently in some sequences.
Could you please let me know how I can fix this error?
Thanks
Are you using a USB<-->Serial adapter? If so, read this: http://digital.ni.com/public.nsf/allkb/0C2ABA463217342686256E2E006DF187
03-25-2011 10:26 PM
Thank you for your message, I used VISA property, and I tried to find which property is not supported, I could not find any, I contacted the manufacturer, they did not have any solution.
I use RS-232 to USB converter, from Newport, Do you suggest to get National instrument product instead?
I am not very familiar to VISA the website that you provided in previous message, suggests following:
Another work around would be to try adding a token to the visaconf.ini file: "WriteTimeoutGranularity = 0" under section "[ASRL-RSRC-ALIAS]".
where should I get visaconf.ini?
Could you please help?
Thanks
03-26-2011 12:37 AM
I've seen this error before. It was with a remote serial port that communicated over Ethernet. I believe the problem can occur with other unusual serial port types as well. Put some probes on the error wires in that subVI to see where exactly it is occurring. I bet it is at the VISA write. Although the VISA write returns this error, it actually wrote out the data okay. The problem is that this error causes all of the downstream functions to not operate.
Check out this KB article Error BFFF003E Occurs after a VISA Read/Write (BFFF003E = -1073807298)
There is a whole lot of unnecessary crap in that VI they provided to do functions such as a timeout and termination character that LabVIEW and VISA already provide. Use a serial port configure to set the baud rate, parity, stop bits, timeout, enable the termination character and set it. Do that at the beginning of your code. Add the VISA Set I/O buffer function like the KB article above shows.
In your loop, you can just do a simple VISA write and VISA read where you request more bytes from the VISA read than you ever expect to get. It will automatically terminate when the termination character is received or the timeout occurs. There is no need to hard code a termination character or timeout like that VI you attached is doing. After your loop is done and your program is ready to end, close the VISA port so your VI cleans up after itself.
03-28-2011 04:06 PM
Hi Ravens,
As you predicted the error occurs in VISA write, and sends out okay when we run vi. I followed the link that you provided, and I changed the read_write.vi as attachment, I put the buffer before VISA write and select the mask=48. Still I get the same error out.
Do you have any recommendation?
Could you let me know how I can simplify as you recommended?
Could you please let me know?
Thanks
03-28-2011 04:32 PM - edited 03-28-2011 04:33 PM
@Salam wrote:
I am not very familiar to VISA the website that you provided in previous message, suggests following:
Another work around would be to try adding a token to the visaconf.ini file: "WriteTimeoutGranularity = 0" under section "[ASRL-RSRC-ALIAS]".
where should I get visaconf.ini?
See: Where is the visaconf.ini File Located?
@Salam wrote:
Hi Ravens,
As you predicted the error occurs in VISA write, and sends out okay when we run vi. I followed the link that you provided, and I changed the read_write.vi as attachment, I put the buffer before VISA write and select the mask=48. Still I get the same error out.
Do you have any recommendation?
You are calling that function, but you are not setting the buffer value. Set it to a large value.
salam wrote:Could you let me know how I can simplify as you recommended?
As has been mentioned by both of us, in your main VI use the VISA Configure Serial Port VI. Wire a value to the termination character that corresponds to the ASCII code of the termination character for the message. Somewhere in the rest of the code you have that's being set, since the read/write VI uses it. Add the setting of the I/O buffer after the VISA Configure Serial Port VI.
Change the read/write VI to look like this (not sure if 500 is large enough for you since I don't know how much data you're expecting - the point here is to make it larger than the largest amount of data you expect):
In the main VI call VISA Close at the end of the program.
I am not very familiar to VISA the website that you provided in previous message, suggests following:
Another work around would be to try adding a token to the visaconf.ini file: "WriteTimeoutGranularity = 0" under section "[ASRL-RSRC-ALIAS]".
where should I get visaconf.ini?
03-28-2011 04:33 PM - edited 03-28-2011 04:36 PM
In my situation, I only set the buffer size for the transmit buffer, and that worked for me.
Maybe that KB won't help you, but it sounded similar. What you could do is just clear that specific error if it occurs coming out of the VISA write. Assuming your Write is otherwise working normally.
Below is what I mean by simpler. The VISA Read will automatically handle the termination character and timeout for you if you have them set.
03-28-2011 05:59 PM
Hello Ravens,
Thank you very much for direction.
I made code exactly as you described, yet it does not communicate with instrument, and the response it the same as command.
Could you please look at the block diagram the vi that is in attachment?
Did I miss any things?
Could you please let me know?
Thanks
Best Wishes