LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Serial using Labview + FTDI RS232 adaptor

Solved!
Go to solution

Hi there,

 

I'm running into a problem, and I think it's probably a simple solution. Maybe you can help?

 

I'm trying to interface with an Alicat M series gas flow meter (manual here) using an FTDI RS232 cable. According to the flow meter manual the serial settings are

Baud: 19200 (default; others can be used if the computer,
its software and the meter are set for the same rate)

Data bits: 8
Parity: none
Stop bits: 1
Flow control: none

 

Using PuTTY I can send a command and receive a response (so the cable and the device are working as expected).

In LabVIEW I'm getting the error

 

Possible reason(s):

VISA: (Hex 0xBFFF0015) Timeout expired before operation completed.

 

I've tried connecting the Tx and Rx pins on the end of the RS232 connector and LabVIEW successfully echoes back the data.

 

I've tried the different permutations for setting the "Termination Character" and "Enable Termination Char", or alternatively adding "\n" to the string to be sent.

 

I'm not sure what else to try. I've attached a .vi here that I'm using to try and get a response from the device. Any suggestions?


Thanks,

Tom

0 Kudos
Message 1 of 7
(1,057 Views)

That error can appear if you have termination character disabled and are trying to read a fixed amount of bytes that's greater than what the flowmeter sends within timeout frame.

 

Eg.: if you have timeout set to 1s and flowmeter sends 100 bytes per second, but you are trying to read 128, you get that error.

 

I can't open your VI due to higher version, to check if that's the case.

0 Kudos
Message 2 of 7
(1,049 Views)

I can't see what you are doing wrong because you are running the newest version of LabVIEW and we have frozen on LabVIEW 2021 due to NI's new "pay us forever" licencing model introduced with LabVIEW 2022...

 

Anyway using an FTDI serial adaptor with its Virtual Com Port and VISA is no different than any other serial port.

 

Most serial communication problems can be solved by watching this video. VIWeek 2020/Proper way to communicate over serial

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 3 of 7
(1,038 Views)

Ah I see - I've got screenshots here for the vi. I don't think I'm doing anything special - I just took the "simple serial" example project, added a few extra indicators and changed the data being sent to a command from the flow meter's datasheet.

 

NC__0-1677770029827.png

 

NC__1-1677770051784.png

 


@RTSLVU wrote:

Most serial communication problems can be solved by watching this video. VIWeek 2020/Proper way to communicate over serial


I will review the video, thanks for the recommendation.

 

 


@AeroSoul wrote:

That error can appear if you have termination character disabled and are trying to read a fixed amount of bytes that's greater than what the flowmeter sends within timeout frame.

 

Eg.: if you have timeout set to 1s and flowmeter sends 100 bytes per second, but you are trying to read 128, you get that error.


I also tried using the continuous serial example, but it has the same error.

As a temporary test to see if this is the problem, if I expect to receive 50 bytes, and set the "byte count" for the Read vi to be lower than that (e.g. 5), should I expect it to successfully show me those first 5 bytes that I was expecting? I did try this, but it had the same error.

Thanks,

Tom


0 Kudos
Message 4 of 7
(1,026 Views)
Solution
Accepted by topic author NC_

1. Your termination character is wrong.  The flow meter uses a Carriage Return (0xD), where you are using a Line Feed (0xA).

2. Before your VISA Write, concatenate a Carriage Return Constant to your command.  This will make it so you do not have to worry about the termination character when you are typing in your command.


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
Message 5 of 7
(1,013 Views)

These are my settings for Alicat MFMs

 

AeroSoul_0-1677828221810.png

 

To get info you need to send the device ID and a carriage return character, before reading a response, although i'm not sure if this is flowmeter thing or breakout box thing. I see you are sending 'a' command, but i don't see the carriage return, which might be why you aren't getting a response.

Message 6 of 7
(967 Views)

 


@crossrulz wrote:

1. Your termination character is wrong.  The flow meter uses a Carriage Return (0xD), where you are using a Line Feed (0xA).

2. Before your VISA Write, concatenate a Carriage Return Constant to your command.  This will make it so you do not have to worry about the termination character when you are typing in your command.


I knew it was something simple! I changed this and it's now working. Thanks for the help.

0 Kudos
Message 7 of 7
(928 Views)