LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Signal-to-Symbol (FXP to Enum) Transformation

Solved!
Go to solution

Hi guys,

 

I am writing an application where I will have an array of temperatures in FXP (from an FPGA Read) which I would like to change to a symbollic representation ('HIGH', 'MED', etc.) depending upon the range in which the value lies.

 

ie;

 

SigtoSym.PNG

 

I have implemented this in the following way;

 

SigtoSymSnip.png

 

This works for this simple example but if I had more than 3 states in my Enum the code would start to get pretty messy.

 

I would like the code to be able to handle;

 

  • Different limits for different Signal Array elements; 0.2 could be 'MED' at one point but 'HIGH' for another.
  • Also be scalable for ~10 Enum values.

Can anyone point me in the right direction? Smiley Happy

 

Many thanks,

 

Pete


Regards,

Peter D

0 Kudos
Message 1 of 6
(2,654 Views)

Not really sure this is the 'right' direction...

Could you exploit the fact that an Enum. is stored as an integer in memory?

 

Doing this for 10 states and different comparisons for each would be difficult, no doubt.

 

 

EnumTypeCast.png

0 Kudos
Message 2 of 6
(2,646 Views)
Solution
Accepted by topic author Pete.Dunc

Signal to Symbol.png

Message 3 of 6
(2,624 Views)

Thanks for your replies Smiley Happy

 

I have expanded on nathand's suggestion to include multiple 'Temperature Readings' and different ranges for each;

 

MultipleRanges.png


Regards,

Peter D

0 Kudos
Message 4 of 6
(2,604 Views)

One additional comment - you may want to insert a "Round toward +Infinity" before converting to U16, otherwise the ranges won't work quite the way you expect.

Message 5 of 6
(2,591 Views)