LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

serial read/write problems (VISA)

I have a device which I am trying to communicate within lv using serial (VISA) read/write functions. I have had no problems trying to communicate with the device (datalogger) using a program such as Hyperterminal, however when I try to move over to labview and simply read/write the same things using string I get no results. I have been using the "Labview <-> Serial" example that ships with labview to make sure that the vi is correct. However I am still unable to communicate with the datalogger correctly. I am using labview 6.1 under w2k pro, and the following are my settings in hyperterminal when I talk to the datalogger.

BPS: 9600
Data Bits: 8
Parity: None
Stop Bits: 1
Flow Control: Hardware

The flow control is n
ecessary for the hardware that I'm using. Could someone please show me what I am doing wrong, or point me in the right direction. Thanks.
0 Kudos
Message 1 of 5
(3,075 Views)
Marshall:

Make sure you are setting up VISA correctly. We recommend you use the VISA Configure Serial Port VI. Make sure you pass it all settings you need.

Alternatively, if you are just using VISA Open directly, make sure you have done 2 things:
1) Go into the NI-VISA configuration utility (MAX on Windows, visaconf on Linux/Solaris) and set your port settings. NI-VISA does not rely on OS settings but keeps its own copy in an INI file for portability.
2) Call VISA Open with mode 4 (load configured settings). If you use mode 0 (the default) then you *always* get 9600/N81 with no flow control. This is for the benefit of instrument drivers so they can get a port handle and always know the state. It's part of the VISA specification and is important fo
r interoperability.

Hope this helps,
Dan Mondrik
Senior Software Engineer, NI-VISA
National Instruments
Message 2 of 5
(3,075 Views)
Another thing to do is to try appending a carriage return to the string that you're trying to send. The example does not do this and many serial instruments require this.
0 Kudos
Message 3 of 5
(3,075 Views)
try using serial communication.vi its in the examples. Modify that till you get the functionality you want... in this case you might need to provide controls for the flow , stop and parity..
0 Kudos
Message 4 of 5
(3,075 Views)
erik_a wrote in message news:<50650000000500000084820000-1023576873000@exchange.ni.com>...
> try using serial communication.vi its in the examples. Modify that
> till you get the functionality you want... in this case you might need
> to provide controls for the flow , stop and parity..

Hi,

I tried to send out some bits to the parallel port, but I discovered
that when I'm writing to the port I could write it one time and if I
want to write again I had to clear the buffer. Maybe that's the
problem....... I now write with the OutPort.VI, that VI writes direct
to the port.

And I had to change my OutPort VI (downloadable by NI.com) because it
had an error with Windows NT, but now it works great. Maybe for
windows 2k you have to do the same.

Greetz,

JJ
0 Kudos
Message 5 of 5
(3,075 Views)