LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

User input number into Serial Command

All:
 
My apoligies for what may be a simple question. (Newbie, LV 8.2)
 
I am controlling a series of 8 Mass Flow Controllers via rs-232 and there are no drivers or VI's for this machine (Environics series 2000) available.  I was able to decrypt the codes I need to send through the VI, and the Basic Write/Read VI works well. The actual command set I will be using is as follows: (ctrl B) ^B FLOW X, TARGET = Y ^C. In this case, X will be hard coded in the string as the mass flow controller number(1,2,3..8), but I need the user to input Y  (flow in SCCM). This sequence will be added to a bunch of other VISA Read functions that I have working, and set into a loop that are just feedback from the machine. 
 
Once this process starts, I will need to grab this number, I think using a write from a string, change to a number, and associate it with a control loop, whereby the 4-20 mA output of an analyzer will add and subract from the mass flow controller value as an automatic adjustment to the output. This value will then get written back into the string, and the loop starts again until it times out or the user hits stop. 
 
The issue I cannot resolve: How can I construct a box on the Front Panel where the user inputs a number (1.0 to 30,000.0), and this value gets injected into the command string that is  on the front end of a VISA Write box? ALso, how can I construct a similar box where the "automatically adjusted" value gets written back into the VISA Write?
 
Any and all help would be much appreciated. Been banging my head on this for much of the past 3 days. I am looking forward to the next available class.
 
Thanks;
Zig. 
0 Kudos
Message 1 of 13
(5,406 Views)

Hello!

you must use the string functions to separate what is before and after the number that you must put there, after that you must use the concatnate string to put your strings together.

 

regards

0 Kudos
Message 2 of 13
(5,397 Views)
Thanks for the quick response, let me give it a shot.
0 Kudos
Message 3 of 13
(5,395 Views)

Hello again,

 

Ni has nice training courses they can save a lot a time to start in Labview ou they sell the course manuals. There are also some nice Labview books, i have several that helped me to start.

Good luck

0 Kudos
Message 4 of 13
(5,387 Views)
Hi ASAT,
      In addition to concatenate strings, the "format to string" function is nice for embedding numeric values in a string.  With regard to using the user-supplied value for the first loop, and a calculated value after that, here's one idea that uses a shift-register.
 
Cheers.
"Inside every large program is a small program struggling to get out." (attributed to Tony Hoare)
0 Kudos
Message 5 of 13
(5,378 Views)
Hi ASAT,
apparently, you were writing an interface for the Environics series 2000 Gasmixing unit. Did you succeed in any way? And would you be willing to post the result? I am currently working on writing interfaces on similar equipment. As I will eventually get to the job of writing an interface for the Environics series 2000 machine too, I'd be happy to have some solution to start with. Any improvements would be open source, of course!
Thanks,
Jens
0 Kudos
Message 6 of 13
(5,051 Views)

Hello,

I am working with a series 2000 Environics gas mixer and I'm having some trouble establishing communication. I tried passing the mixer a command of the format in the user manual (eg. STX Time? ETX) but I get no response. This is the case when I use the Basic Serial Write and Read VI in the example finder. I also tried using MAX but I get a timeout error. Any help would the greatly appreciated!

 

 

0 Kudos
Message 7 of 13
(4,869 Views)
  • Sorry its been a long time since I looked at this code, but...here goes...to write to this machine, you will have to put the commands togehter in a string, then push it through one of the VISA utilities, into the isntrument, then read it back. Where it took a longtime of decrypitng was that the command part of the string had to be written in hexadecimal, then can be converted back to "normal" language. It is a little time consuming, but once I had this, it was pretty easy to punch in commands.  If you look at the attached picture, you can see how I put the strings together. In the black circle is the command for"Flow Update" written in hex. THe other parts of the string are converted back into "normal". All of the stings concatenate and are then written to the blender. Please dont mock my code, I realize its ugly (it was late, and I am really bad at this). Good Luck.
0 Kudos
Message 8 of 13
(4,859 Views)

Why don't you have the STX or ETX in the string you pass the instrument or do I just not see it? Also can you explain what the hex part of the string is? I'm just a little confused

 

0 Kudos
Message 9 of 13
(4,839 Views)

You really need to get an understanding of ASCII and control codes. STX cannot be sent by typing 'STX'. If you get an ASCII table (google it), you will see that STX stands for start of text and you send hex 02. A string control/constant can be set for hex display (right click). You could also set it for '\' codes Display and enter \02. A third way is to use an array of U8 and use the Byte Array to String function. A typecast of a U8 to a string also works.

 

This is a highly discussed issue. Search for 'serial hex' and you will find hundreds of threads.

Message 10 of 13
(4,833 Views)