Hugh Ward
Hugh Ward

Reputation: 121

How do you map values in LabVIEW? Is there a best way or convention?

I have an angle in degrees, and need to map it to a voltage.

i.e. left: -360 degrees = 0V, straight: 0 degrees = 5V, right: 360 degrees = 10V.

How do you map values in LabVIEW?

I found scaling under the numeric pallet but they seem to be very specific (e.g. for a thermistor) with no generic block.

Upvotes: 0

Views: 2330

Answers (2)

nekomatic
nekomatic

Reputation: 6284

If the mapping you want is described by a mathematical formula, just implement that calculation using LabVIEW functions. In your case, assuming it's a linear relationship, the formula is voltage = (angle + 360) / 72 .

You could code this in LabVIEW with an Add function followed by a Divide function, or if you think it's clearer written out as a formula then you could use a Formula Node.

If you need to use this calculation in more than one place in your application, make it into a subVI.

Upvotes: 4

Achuthaperumal RK
Achuthaperumal RK

Reputation: 79

Looks like you're trying to read a analog gauge value! Actually it's very simple.

  1. Build a lookup Table
  2. Perform Interpolation followed by thresholding.

Refer the VI Snippet (Just paste this image into your block diagram).

Block Diagram

Sample Output:

Front Panel

Upvotes: 0

Related Questions