LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Serial communication with visa, need help

I'm attempting to connect to a digital level that has a serial port connection.  The digital level transmits at 9600 buad, one stop bit, no parity.  The documentation on the level says "Hi impedance except during transmission bursts.  RS-232 input; high signal requests data output."

 

I can't get any response from Level.  I've confirmed the serial port with another device. I've tried all the flow control options with no luck.  I'm assuming it is an issue with the request for data.  TD is on pin 2 of the serial connector and REQ is on pin 5.  Attached is the vi I'm using to attempt to debug.

0 Kudos
Message 1 of 6
(2,656 Views)

Before trying to talk to your device through LabVIEW code, try MAX (Measurement and Automation Explorer).  You should see all of the COM ports that your machine recognizes, can open a VISA Test Panel, set up the parameters (9600, N, 8, 1 are probably what you want).  You want the manual for your device, which might have things such as "Initialize by sending the string  ABC\r\n".  The point is that you can use MAX to write to the port, read from the port, and explore.  If you get characters and they look a little garbled, try varying the Baud rate (I'd stick with standard rates, 9600, 19200, 38400, 57600, and 115200), Parity, and 7/8 setting (especially if the equipment to which you connect is pretty old).

 

When you configure VISA in MAX, pay attention to the Termination Character setting (again, consult the Device to which you connect).  It is really helpful if the Device sending you stuff uses a Termination Character, and if it does, a common one is \n, NewLine, 0x0A.  This lets you read, say, 1000 characters and have the read "finish" when the NewLine is received, so you don't need to worry about the size of the message being sent.

 

Once you understand how your VISA device really works, you stand a better chance of getting data from it using LabVIEW's VISA commands.

 

Bob Schor

0 Kudos
Message 2 of 6
(2,641 Views)

"High impedance except during transmission bursts" isn't standard for RS-232; normally it should hold the line in the "mark" state (-3 to -15 V) while the bus is idle, which then goes to the "space" state (+3 to +15 V) to signal the start bit. If the line is floating while idle then who knows what the receiver is seeing, and if there isn't a clear transition from mark to space at the start of the start bit, then maybe the receiver isn't detecting it properly. Can you attach or link to the documentation for your level?

0 Kudos
Message 3 of 6
(2,637 Views)

The documentation doesn't say what command to send it just says that if REQ is high it will send data or if it sees a transition.  I've attached the document.

0 Kudos
Message 4 of 6
(2,630 Views)

Communication is entirely one-way, so there's no command you can send, the only way to trigger a transmission is to take the REQ line high. Are you powering the device with a battery, or an external power source? Are you connecting between the REQ line and the BATT+ line to request transmission? Can you try connecting REQ to BATT+ before installing the battery or connecting power, so that the device starts transmitting continuously? And it shouldn't matter, but you can change the handshaking configuration from "XON/XOFF" to the default "none", since it doesn't actually use handshaking. It looks like the default termination character is correct for this device.

0 Kudos
Message 5 of 6
(2,619 Views)

I've used that level before and was able to get LabVIEW tor read it without a problem.  I'm attaching the VI I created, which was back in my early days of LabVIEW and I used the Instrument I/O Express VI.  But I know that it worked.

 

There was nothing special about it other than using the serial cable that came with it, or perhaps was separate purchase.

0 Kudos
Message 6 of 6
(2,597 Views)