View Single Post
  #2   Spotlight this post!  
Unread 15-02-2009, 13:58
airnate airnate is offline
Registered User
FRC #0236 (Techno Ticks)
Team Role: Programmer
 
Join Date: Feb 2009
Rookie Year: 2009
Location: southeastern CT
Posts: 93
airnate is a jewel in the roughairnate is a jewel in the roughairnate is a jewel in the rough
Re: Paramaterizing Case Statements

Yes. And no. (there, that was simple, right?)

The problems is that your question is not as simple as it may seem. It really depends on exactly what you are asking.

Yes, you can perform a calculation and wire it to an indicator and then use the indicator's local variable later in the program to read back the value. However, in general, if you can keep your value in a wire (i.e. instead of using local variables), your code will be faster and use less memory.

Note that for the size of the FRC projects, this is really not likely to make a difference in performance, but it's something to keep in mind as you use LabVIEW.

If you are asking if you can actually evaluate expressions as part of the case statement itself, then the answer is no. All of the case expression needs to be evaluated up front prior to the actual case statement.

What you could do is use enumerated types or strings to help make the case statement more legible. If you pass in the enumerated type or string for which you wanted to execute code, the case statement would display text for each case (more like a C switch statement).
Reply With Quote