Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

VISA Write.vi Options for the Write Buffer

I have jsut a plain old string 'pink box' with the command typed in there, attached to the Write Buffer of the VISA Write.vi.  However, when I run my program, the instrument does not recognize the command.  If I use the Example, "Basic Serial Write and Read.vi", I can type the exact same command into the text box, run it, and get teh expected returned data.  I incorporated teh '\s' and the '\n' in all the places that they need to be.  i cctually copied the line from the example and pasted it into t string 'box', but it doesn't work. 
i've been playing with this for almost 4 hours now and I just can't seem to get it.  Is it possible that the Write Buffer only accepts the data from the text box and not the string box?  This doesn't make any sense to me.  I can post the VI if someone really wants to take a look at it. 
Thanks in advance....
0 Kudos
Message 1 of 12
(6,267 Views)
Assuming you mean a text constant on the block diagram, my guess is that you did not right click on it and select '\' Codes Display before you pasted the text. It is this setting that interprets the \n as a control code and not as the separate characters "\" and "n". If that's not it, post the VI.
0 Kudos
Message 2 of 12
(6,264 Views)
That looks better, but it still is not working....
Here is the VI
 
0 Kudos
Message 3 of 12
(6,263 Views)
Well, for one thing, you don't have a read in your programSmiley Wink. Your output string is what you're writing. Also, in the Basic Serial Write and Read, did you use both \r and \n or just \n?
0 Kudos
Message 4 of 12
(6,255 Views)

Dennis,

The reason there is not a read file is because I do not need that at this time.  I can monitor the instrument to see if the command has been executed by reading the LCD panel on it.  If the command goes through "vulos\spreset\sactive\sfreq\s301.025\n", then the front panel LCD display fill show me that the instrument changed frequency to 301.025.  If I use the 'Basic Read and Write" program, and change the 'write' input from a 'user defined input string' to just a plain old regular string (with ''\' codes displayed'), it will work.  If I try to combine 3 different strings by using the 'Concatenate Strings' tool, it doesn't work.  The reason I do this, is because I put it into a loop.  When the defined frequency completes that cylce of testing, I want to change frequency and perform the tests again.  This leads me to believe that the output of the 'Concatenate Strings' tool is not in the ''\' codes displayed' form.  Is there a way to dump the output into a string that can be formated into the '\' codes displayed and then input that into the VISA 'Write'

Thansk again for your help....

0 Kudos
Message 5 of 12
(6,233 Views)
The concantenate string does not change the input string. If you were to turn on '\' Code display for the Output string indicator, you would see everything that you input. You say you use "vulos\spreset\sactive\sfreq\s301.025\n" to set the frequency. The string that you have in your example is "vulos\spreset\sactive\s301.100\n\". You're missing the keyword "freq".
0 Kudos
Message 6 of 12
(6,229 Views)
Thanks for the help Dennis.  I started over from scratch, and it works!  I must have missed a '\' or something somewhere.  Smiley Happy
0 Kudos
Message 7 of 12
(6,225 Views)

I want to connect PICA II 104/8 printer with labview via NI VISA. It will work when I'm connect using USB but its not work in RS232. I want to write prn file through LabView. Please help me for this problem.

0 Kudos
Message 8 of 12
(4,865 Views)

Hi, this is a simple read and write buffer VI. My program is running, but the read buffer is not able to read the data. Since I can see you have some advance knowledge in this, can you see what I missed to make it work?

 

Thanks.

0 Kudos
Message 9 of 12
(3,108 Views)

Not many people have LabVIEW 2020 installed yet.  Can you back save to say LabVIEW 2018?  Also you might mention the hardware you are working with.  What the expected response is, what the termination characters are, etc... i.e. give more details.

 

Without seeing the code my guess is you have wired the VISA Write return count to the VISA Read Byte count.  VISA Read byte count input is just a buffer, you can allocate a lot more room that you expect to need.  Try just wiring a constant like 1024 for an expected short reply or 200000 for a full scope trace.

 

You could also look at the code on your machine for examples..https://zone.ni.com/reference/en-XX/help/371361R-01/lvinstio/visa_read/#examples

  • Continuous Serial Write and Read VI: labview\examples\Instrument IO\Serial
  • USB RAW - Bulk VI: labview\examples\Instrument IO\VISA\USB
  • GPIB with VISA functions VI: labview\examples\Instrument IO\GPIB

 

Craig

0 Kudos
Message 10 of 12
(3,097 Views)