09-10-2012 04:33 AM
Hello everyone. I have made a serial port block diagram in Labview, to make some measurement in my scale. The scale is connected with a serial port connection to my PC. The block diagram is a basic serial write and read diagram, so i have to make a array to enter my different commands from my scale. How do i make that array in this case ?
I have uploded the VI.
Thanks in advance
Oesen
09-10-2012 07:43 AM
Without knowing the commands, there's not much we can do to help.
Do you really need an array of strings? Or just a case structure that outputs a string?
Look inside of the String palette. There's all kinds of fun functions for parsing, building, and converting to/from strings.
09-10-2012 10:50 AM
Right now you have a completely empty array - a shell that doesn't contain any data. You need to drag some type of control - such as a string - into the array control to make it into an array of strings.
09-10-2012 01:14 PM
Perhaps this might be what you are looking for?
09-10-2012 02:09 PM
Thanks for the replies 🙂
Sorry i can't open the the file because it is 2011 version of Labview, and i have the 2010 version :(. But i have a lot of commands :
PRT\r\n = Reading the value in gram
ON\r\n = ON state for the scale
OFF\r\n = OFF state for the scale
I can't remember anymore, but i have to make a program, where i can choose one of the commands i want in the array and run the program. So i can make measurements for the scale with using all those commands in a easier way 🙂
09-10-2012 02:14 PM
Will you consider a different approach? Create an enumeration (which should be a type definition) containing all of the commands. Put the enumeration control on the front panel so you can select the command easily. Wire the enumeration value into "Format Value" which will get you the corresponding text; as a format string use "%s\r\n" (without the quotes).
09-10-2012 04:33 PM
@nathand wrote:
Will you consider a different approach? Create an enumeration (which should be a type definition) containing all of the commands. Put the enumeration control on the front panel so you can select the command easily. Wire the enumeration value into "Format Value" which will get you the corresponding text; as a format string use "%s\r\n" (without the quotes).
A slightly different flavor to this one is create a string with multiple lines, each line being a command. Then use "pick line from string" function and create an enum to wire up to the "line" input. This way, if the command text isn't very meaningful as far as letting the programmer of the device know what the command actually does, you can create an enum with meaningful text which will index the proper command to send to the device. You could also take a similar approach to this with index array, if you don't favor the multiline string.