LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Writing strings

Hi, I'm new to LabVIEW and would appreciate some help. I'm not sure where to start. I'm using a peristaltic pump with serial communications and I want to control the flow rate by sending a command string using the serial write to port.vi. An example string is: 1S0155513 where 1 is the pump address, S is the type of input (speed), 01555 represents the flow rate (155.5 rpm) and 13 is the carriage return that must complete the command string (each sting must have the order: address, speed, carriage return). I would like to vary the speed using a digital control and have it update as soon as the speed is changed. Any ideas?

Thanks in advance,

Adrian
0 Kudos
Message 1 of 3
(2,675 Views)
Use the "Format into String" with the following inputs:

Input string: (nothing)
Format String: %d%s%d13
data inputs: pump address, input type (string, i.e S), speed/10 in U16

If you run this in the loop, and set a case where the output is only sent if the data changes, you will make efficient use of memory and processor this way. Be sure to add a delay

The attachment is in LV6i. I have input constants for S and Pump Address so that it can be used as a model for other commands with similar results.
Example attached
Message 2 of 3
(2,675 Views)
Labviewguru,

thanks very much, it worked!

Adrian
0 Kudos
Message 3 of 3
(2,675 Views)