From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

no output

I am not getting any output. There are no errors when I run the vi file . I am trying to do serial communication with a machine to which we have to pass commands and which inturn has to return data, but even when I try any command I am neither getting any output nor byte count at port. The machine which i am trying to communicate has db9 connector, I am using db9 to usb converter cable and trying to communicate with the pc. I am using VISA for serial communication. I also did a loop back test by shorting pin 2 and pin 3 in db9 to usb cable in which i got the output for the given input. It would be very helpful if I get any advice .

0 Kudos
Message 1 of 8
(3,096 Views)

Bytes at port is the wrong thing to use about 99% of the time.

 

Questions:

1.  Why are you running the loop as fast as it can?  You would would probably only get a byte at a time and frequently zero bytes.

2.  Are you sure you are sending the correct command on VISA write?  (You didn't attach a VI so we can't tell what you are actually sending.)  Does your command need a termination character that you didn't send?

3.  What is the point of the string to path to string array in the loop?

 

Get rid of bytes at port and read a fixed number of bytes.  More bytes than the longest message you ever expect to receive.

0 Kudos
Message 2 of 8
(3,083 Views)

How do you know you are not getting any bytes at port? Your loop is spinning so fast that you would miss the occasional iteration where the bytes at port is >0.

 

It tyupically helps if you would attach a VI instead of a picture. There are some really weird code constructs.

0 Kudos
Message 3 of 8
(3,081 Views)

First off are you using the right cable?

 

I have found you can not always depend on the gender of the serial port connector. There once was a standard that said all computers are DTE and MODEMs, printers, etc. are DCE so you used a straight through cable. But that standard seems to be ignored by a lot of equipment manufacturers, lucky computer manufacturers are still sticking to the DTE standard.

 

You should be able to communicate with your machine using any serial terminal program like Hyperterm or Terraterm.

 

Try using a null modem cable or adaptor in between your USB/Serial converter and your equipment 

 

Once you get the hardware working and can comunicate with your equipment using a terminal come back and we will discuss your LabVIEW code.

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 4 of 8
(3,070 Views)

The first thing we need is to know exactly what is being sent that you are trying to read.  A detailed explaination of the message protocol is needed.  Then we can get down to the nuts and bolts.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 5 of 8
(3,053 Views)

Hi, I did not correctly state my problem. I have to send command "a" to the device with termination character ( both carriage return  and line feed). The hardware connections are correct and i have verified by loopback test. I have to get 6 decimal values from the device. I have attached VI file for reference. Please reply as fast as possible.

0 Kudos
Message 6 of 8
(3,010 Views)

How are the decimal values coming from the device formated?  Does the device send a carriage return and line feed at the end of its message?  If so, you do not need the loop nor the Bytes At Port.  Just tell the VISA Read to read more bytes than you ever expect in this message.  The VISA Read will stop reading when the termination character is found (default is the line feed, which you want).


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 7 of 8
(2,992 Views)

@madara77 wrote:

Hi, I did not correctly state my problem. I have to send command "a" to the device with termination character ( both carriage return  and line feed). The hardware connections are correct and i have verified by loopback test. I have to get 6 decimal values from the device. I have attached VI file for reference. Please reply as fast as possible.


A loopback test does NOT verify hardware connections between your computer and device are correct.

 

A Loopback test only verifies your serial port is working.

 

As I said before using a terminal program like Hyperterm or Terra-Term can you send your command and do you receive the proper responce?

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 8 of 8
(2,968 Views)