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: 

Not getting data through RS-232 cable in LABVIEW through VISA serial

Solved!
Go to solution

Hello,

Actually, we are working on Data Acquisition system using 89C51 micro-controller. We have been interfacing analog sensor to 89C51 through ADC0808 and after getting the digital data on a port, it is programmed so that it converts the digital data of (0 - 5 V) in 0-255 number format(as the ADC is 8-bit wide) and then transmitting the data from micro-controller through serial communication via RS-232 port(MALE).

 

But we do not have direct Rs-232 port on our laptop, so we are using USB to serial DB9 connector and female to female DB9 connector(as our port is MALE one) for their respective connections(please find the attached photo).

 

In labview our aim is to indicate data coming from RS232 port(which is in the form of number) we are using VISA serial function palette and reading the data from VISA read.

We have NI VISA 17.0 installed, is there any additional requirement ??

And we are facing the problem of not getting the data in LABVIEW.

 

Actually we don't know where we are wrong, whether we should use VISA serial or VISA usb ??

So kindly help as soon as possible.

 

We are attaching the required files(images).

Thank you !!

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

An RS232 USB dongle will present itself as serial port. So, VISA serial would do.

 

Testing the port would be first thing on my mind. You could use hyperterminal or something like that, if you want to rule out mistakes in LabVIEW. Use a loopback (connect Rx and Tx, pin 2 and 3). Everything you write should also be read.

 

Then test LabVIEW serial communication. Using the same loopback trick, see if the serial examples work.

 

Then test the cable. Connect Rx and Tx at the other end of the cable to see if it works.

 

Then test the code.

 

Using bytes at port is not recommended. Instead consider \n as a termination character. Then simply set the count to 100 or so, and it will return the chucks split at \n.

 

A wait in that while loop might be a good idea. You might get only single bytes if you read at maximum speed.

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

How do you have your microcontroller's UART wired to the DE-9 port? Are you converting the microcontroller's logic-level signals to/from RS-232 levels?

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

Yes, We are using max232 for logic conversion between microcontroller and rs232. Can you please guide us how we can check that microcontroller is transmitting data or not.?? 

0 Kudos
Message 4 of 8
(3,111 Views)

Do you have an oscilloscope or logic analyzer? An oscilloscope on the output of the MAX232 would be best.

0 Kudos
Message 5 of 8
(3,107 Views)

A LED and a proper resistor between GND and Tx will blink (or burn) if there is communication. It works before and after the MAX. Haven't done this myself, don't accept any responsibility.

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

Connect the TX pin to the RX pin then try to write something in MAX across the RS-232 bus.  It should echo all of your entries back on the screen for what is received.  If it mimics your entries, then at least the TX/RX part is working of your buffer is working.  Other issues may still be occurring - Address them one step at a time.

Help the Community (and future reviewers) by marking posts as follows:
If it helped - KUDOS
If it answers the issue - SOLUTION
0 Kudos
Message 7 of 8
(3,086 Views)
Solution
Accepted by topic author pdpanchal05

@pdpanchal05 wrote:

 

But we do not have direct Rs-232 port on our laptop, so we are using USB to serial DB9 connector and female to female DB9 connector(as our port is MALE one) for their respective connections(please find the attached photo).

 



Are you sure you are using the right kind of cable?  If both of your ports are male, thus needing a female to female cable to physically connect, that implies both of your ports are DCE type.  You would need a null modem cable that physically crosses the wires so that the receive pin on one side (2) goes tot he transmit pin on the other end (3), and vice versa.   Also hand shaking lines are crossed.

 

This isn't always the case, but unless you are sure you have the correct cable, then there is a 50% chance you have the wrong cable.

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