LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Is Case structure what I need (newbie)

I'm attempting to write a VI to control a multi zone furnace. The board(s) used to control the furnace take about 25 different commands.

I'll be sending commands (strings) over a serial port. Commands take differing arguments so there are variable inputs for concatenating

a string into a valid command before writing to the serial port. Further complicating things, each string includes a checksum at the end.

 

Currently users are expecting to select a command (in simple english, not what is sent over the port) and provide added info based on

the command. I then gather this up, format a string that the board understands and write it to the port.

 

I'm guessing the Case structure is what I should be using. But as far I can tell (I'm a newbie so I can't sure of much), for each case in the

structure it appears that the inputs to the concatenation have to be the same in type, order and number. I keep getting errors if I attempt

to use a Case structure where one case uses 2 strings to concatenate into a command, another uses 5 strings etc. I get unwired element

errors.

 

Is the Case structure limited in the way I'm seeing or is there a way around this (something a newbie doesn't know)?

 

Or is there a different structure I should be using?

 

I've attached 2 VIs (both are just baby steps at this point, the "bad" is expecting more strings than there are).

 

Any advice would really help.

 

Thanks,

Dave

Download All
0 Kudos
Message 1 of 13
(3,059 Views)

Since you are just concatinating strings, just output empty strings out of those cases that shouldn't have that input.


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
0 Kudos
Message 2 of 13
(3,056 Views)

.... Or move the concatenate function inside the case structure.

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
0 Kudos
Message 3 of 13
(3,046 Views)

Thanks crossrulz, aputman,

 

I'll try both ways and see how things go. It's a pain in the neck being a newbie!

0 Kudos
Message 4 of 13
(3,037 Views)

@dkl234 wrote:

Thanks crossrulz, aputman,

 

I'll try both ways and see how things go. It's a pain in the neck being a newbie!


But you have the right attitude and that makes all the difference in the world!

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 5 of 13
(3,016 Views)

We were all newbies at one point.  Just keep asking questions and learn from our mistakes.


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
0 Kudos
Message 6 of 13
(3,004 Views)

I think a State Machine with an Event Structure is right up your alley for this project. 😉

0 Kudos
Message 7 of 13
(2,970 Views)

Eric

 

You might be right. I'm at the start of the learning curve on labview. One thing is for certain, I don't know enough about labview

to know when I might be going down the wrong road. So in the mean time it's a number of mini vis until I can see the light

on the overall project. 

0 Kudos
Message 8 of 13
(2,938 Views)
Another option is a formal instrument driver. You can use the Create Instrument Driver wizard to generate a basic template and then start customizing. You can look at existing examples by browsing http://www.ni.com/downloads/instrument-drivers/
0 Kudos
Message 9 of 13
(2,922 Views)

I use the loaded templete examples as a good starting point and go from there. You can always come here if you get stuck. I do. Smiley Happy

0 Kudos
Message 10 of 13
(2,908 Views)