LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

NI VISA LabVIEW cannot control external pump

Hi, 

 

I am trying to control a Masterflex L/S peristaltic pump with LabVIEW NI-VISA functions using the below vis.

I was able to run the vi with no error but the pump is not running. Please help. 

I connected the pump to my laptop with a RS 232 db 25 to db9 cable and a RS 232 db9 to USB adapter.

The adapter brand is prolific. I've installed the USB to serial driver from prolific. The virtual com port is showing in device manager, NI MAX and in labVIEW. The properties are set to be 1 start bit, 7 data bits, one odd parity bit, and one stop bit at 4800 bits per second which all match the serial data format for the pump.

 

The pump model is 7551-20. The pump manual can be found here: https://pim-resources.coleparmer.com/instruction-manual/a-1299-1127b-en.pdf

 

initialization vi: 

Screenshot 2023-06-18 212542.png

control vi:

wen88_0-1687148885711.png

 

 

0 Kudos
Message 1 of 14
(1,159 Views)

better to share the code.

better to have command and then read it back to make sure you can communicate.

 

from your picture, the question is.

what type of string constant? codex or normal string?

0 Kudos
Message 2 of 14
(1,141 Views)

Here are the VIs.

I tried to use NI MAX to test the communication.

After I sent the command, I tried to read it back and it is always returning the exact string that I passed to the pump. 

I am not so sure about the string type. I think it is a normal string.

Download All
0 Kudos
Message 3 of 14
(1,136 Views)

Hi,

 

As far as I see it, your communication problem is just the tip of the iceberg.

 

The Vis will run exactly once, with the settings set. I would implement a simple state machine for a communication task like this.

 

Can you get a communication with your pump in NI Max? Advantage is you can control your pump while the vi is running, and you don't have to first search for and start a separate Vi.

 

Edit: Read the manual from Page 3-29/30. The procedure how to commuicate with the pumpe and the commands are explained there. (easily solved with a state machine)

 

Edit2: Watch Crossrulz' lecture on https://labviewwiki.org/wiki/VIWeek_2020/Proper_way_to_communicate_over_serial 

0 Kudos
Message 4 of 14
(1,102 Views)

Hi,

 

Yes, simple state machine is the final plan… I am testing it with the initial vi that only runs once as the pump only needs one time command, it should run until it receives another command. 

NI MAX communication doesn’t show any error but I am not able to get the pump running with NI MAX as well.

 

thanks

0 Kudos
Message 5 of 14
(1,094 Views)

I reviewed your code.

Change \r to \n 

please set this as ANSWER or KUDO this post, if it help you.


0 Kudos
Message 6 of 14
(1,079 Views)

Hi,

 Changing it to /n doesn’t solve the issue. The device accepts CR or 0D in hex which corresponds to /r in ‘/‘ code.

0 Kudos
Message 7 of 14
(1,031 Views)

Most serial communications issues can be solved by watching this video: VIWeek 2020/Proper way to communicate over serial

========================
=== Engineer Ambiguously ===
========================
Message 8 of 14
(1,025 Views)

@wen88 wrote:

Hi,

 Changing it to /n doesn’t solve the issue. The device accepts CR or 0D in hex which corresponds to /r in ‘/‘ code.


1. Watch the direction of your slashes.  You should be using \n (assuming your constants are in "\ Codes" display mode).

2. The device in question actually uses Flow Control.  Set the Flow Control to "RTS/CTS".

3. Read carefully the communications section of the manual.  There was too much for me to really dive into it in a reasonable amount of time.


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 9 of 14
(1,013 Views)

Thanks for reply.

/ is a typo when I reply, just made sure it is \ in the vi.

I also changed it to \n and the flow control to RTS. (Flow control changed to RTS in device manager and NI MAX as well)

now the vi returns error 1073807339 for every VISA write function.

0 Kudos
Message 10 of 14
(994 Views)