04-06-2013 10:15 AM
I do not think you can format the case selector to show leading zeros. Since only the programmer will see this, he or she will have to adapt to the display of 011 as 11. You can of course have case 0 as numeric.
Lynn
04-07-2013 08:03 AM
@captain_harlock wrote:
Although I wonder, isn't there a a much more elegant way of indexing a case struct with mutually exclusive booleans?
This thread is NOT about mutually exclusive booleans, so you should probably have started a new thread. You have a very different problem!
Unfortunately, you don't show the inputs to your "in range & Coerce" functions, so we cannot tell what you are doing and we cannot really help.
Where do the mutually exclusive booleans come from? Is this from an instrument or from a user control?
04-08-2013 01:54 AM
@paul_a_cardinale wrote:
I suggest using radio buttons.
Unfortunately my booleans are not a manual input (i.e. front panel), they come from a computation about intervals, ranges and max/min outputs.
04-08-2013 02:03 AM
So why don't you tell us a little bit more? Maybe there is a much simpler solution!
04-08-2013 04:10 AM
@altenbach wrote:
So why don't you tell us a little bit more? Maybe there is a much simpler solution!
It's not a very big deal.
I'm writing a little program to build the spurious emissions mask limits for a point-to-point RF system.
So on the front panel I have two inputs, the Channel Spacing (CS) value, and the frequency carrier f_0 value, plus a parameter that in the final realease will not be an input but will be taken directly from the Spectrum Analyzer (the Max range of the SA).
There's a fourth param, the breakpoint (BP) frequency, which is the value on which the mask limits jump from -50 to -30 dBm.
So according to the ETSI spec I have 4 cases, mutually excluding:
Hence my issue with that "boolan driven" case struct.
04-08-2013 06:44 AM
Build your threshold numbers into an array and use something like what's described here or here. Much less code! 😄
04-08-2013 06:47 AM
Or here...
04-08-2013 09:32 AM - edited 04-08-2013 09:35 AM
Justto put my 2 cents in... regarding to the original subject with multiple Case inputs, I prefer the solution shown in the attached pictures. It uses the type cast function to cast the U32 values to an Enum (which MUST be of U32). This makes it more readible to the programmer.
Enum- Items in Order:
04-08-2013 09:58 AM
everybody, thanks for the hints
05-02-2013 09:59 AM
C B A Yellow Red Pink Blue
0 0 1 1
0 1 0 1
0 1 1 1
1 0 0 1
----------------------------------------------------------