Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

I tried running the example VI Serial communication.Vi.The first time I ran the VI it wrote the string and read back the same correctly.But if I run it again the Read buffer is displaying some junk characters.Can any body tell me what is the problem?

I tried running the example VI Serial communication.Vi.The first time I ran the VI it wrote the string and read back the same correctly.But if I run it again the Read buffer is displaying some junk characters.Can any body tell me what could be the problem?
0 Kudos
Message 1 of 12
(5,011 Views)
Hello,

Are you using the LabVIEW <-> Serial.VI example program? It sounds like you're looping back your serial port by shorting pins 2-3, is that correct? Or are you reading from another device?

Random characters can be caused by line noise or sometimes the device to which you are communicating sends out more than you expect. If you are communicating with a device, do you get this same behavior in Hyperterminal when you try to communicate with the device? Do your data bit/stop bit/parity/flow control/baud rate settings match up between your device and your serial port? Are you using an onboard serial port, or some other serial device?

Let me know the answers to these questions if you're still having problems and we'll get it figured out.

Scott B
.
Applications Engineer
National Instruments
0 Kudos
Message 2 of 12
(5,011 Views)
thanx..I sorted out the problem..The VI is running correctly now..I didn't short the pins 2-3..I had hooked the other end of the serial cable to the fusion splicer.

Now the problem is I am expecting 10500 bytes from the serial port but the Number of bytes at the serial port is only 4096.What could be the problem? I tried waiting for 1000ms.But still it is the same.

Viji
0 Kudos
Message 4 of 12
(5,012 Views)
Hey Viji,

4096 is the default I/O Buffer size. You can change it with a VISA function. See this KB:

http://digital.ni.com/public.nsf/websearch/D1BA2FE065AAE32E86256C170054F1C5?OpenDocument

Scott B.
Applications Engineer
National Instruments
0 Kudos
Message 5 of 12
(5,012 Views)
thank you.I tried to set the VISA set I/O buffer size to 16384 and I get a warning that the specified I/O buffer is not supported.

Viji
0 Kudos
Message 6 of 12
(5,012 Views)
Viji,

What version of VISA and LabVIEW are you using? What is the exact error number that you get? Are you wiring a "mask" into the Set IO Buffer size so that you specify whether you are changing the read buffer, write buffer, or both? You should wire a 16, 32, or 48 respectively into the VI terminal labelled "Mask" to do this. See the help on this VI by pressing Ctrl-H and hovering your mouse over the VI icon for more information.

Hope this helps.

Scott B.
Applications Engineer
National Instruments
0 Kudos
Message 7 of 12
(5,012 Views)
I am using LabVIEW 6.1 under linux platform.The warning number is 1073676424. I am wiring a 48 at the terminal "Mask". I came to know that this functionality "Set I/O buffer size" is not supported under linux.If that is the case is there any other alternative other than using VISA to set the I/O buffer size. I think this should be possible because I tried reading the contents of the serial port using the utility minicom and I get the complete data of 10500 bytes from the serial port.I am trying the same with LabVIEW.

Thanx for any help.

Viji
0 Kudos
Message 8 of 12
(5,012 Views)
Viji,

I tried this on Redhat with VISA 3.1 and got no error. What VISA version are you using? Also, try doing this in VISA Interactive control. It should be located in /usr/local/bin. Run "NIvisaic". On the "Interface IO" tab, set the VI_IO_IN_BUF to 10500 and see if you still get the error in the "Return Value" section of the dialog box.

If you still are getting the error, could you tell me more about what version of linux you are running, flavor, kernel, etc.?

Scott B.
Applications Engineer
National Instruments
0 Kudos
Message 9 of 12
(5,012 Views)
I upgraded the VISA driver to version 3.1 on Linux (Mandrake Linux 9.1)..I tried the VISA interactive control.But if I run the command "NIvisaic" I get a prompt that "The Visual class not supported".

Viji
0 Kudos
Message 10 of 12
(5,012 Views)