You are here

Arithmetic Expressions

26 July, 2019 - 09:47
Available under Creative Commons-ShareAlike 4.0 International License. Download for free at http://cnx.org/contents/5b6e61df-b830-48cb-9764-94696cb47c80@1.3

The next program converts degrees from Fahrenheit to Celsius using the formula

media/image10.png

In the Block Diagram window, select the subtract, multiply and divide from the Functions » Mathematics » Numeric menu

media/image11.png
Figure 1.10 Numeric Operations 

Wire the subtract, multiply and divide functions as shown in Figure 3.11.

media/image12.png
Figure 1.11 Subtract, Multiply and Divide 

Right click on the upper left terminal of the subtract function and select Create » Control from the pop-up menu.

media/image13.png
Figure 1.12 Create Control 

Re-labelx as Fahrenheit and wire the terminal as shown in Fahrenheit Input Control.

media/image14.png
Figure 1.13 Fahrenheit Input Control 

Right click on the lower left terminal of the subtract function and select Create »Constant and type 32.0.

media/image15.png
Figure 1.14 Fahrenheit Numeric Constant 

Repeat the process to generate numeric constants for the multiply and divide function with 5.0 and 9.0 respectively.

media/image16.png
Figure 1.15 Fahrenheit Numeric Constants  

To complete the program, right click on the right terminal of the divide function and select Create »Indicator. Re-label x/y as Celsius. The fnal diagram is shown in Fahrenheit to Celsius G Diagram

media/image17.png
Figure 1.16 Fahrenheit to Celsius G Diagram 

Switch to the Front Panel window to run the program. Save the program as Celsius.vi. Try various Fahrenheit values to see the corresponding Celsius values. You have successfully finished a Fahrenheit to Celsius calculator.

media/image18.png
Figure 1.17 Fahrenheit to Celsius calculator