This program converts an array of Fahrenheit values to Celsius. Create numeric input and output arrays and label them Fahrenheit and Celsius respectively. In the Fahrenheit array enter the values 0, 20, 40, 60, 80, 100, 120, 140, 160, 180 and 200 at ofsets 0 through 10 as shown in Numeric Input and Output Arrays.
Right click in the Block Diagram window, navigate to Programming » Structures and click on For Loop.
Click and drag to create the For Loop as shown in Creating For Loops and For Loop.
Right click inside the For Loop and select Select a VI... from the pop-up menu. Find the Fahrenheit to Celsius.vi and clickOK. Drop the function inside the For Loop.
To complete the program, wire the Fahrenheit input array to the input terminal of the Fahrenheit
to Celsius function and wire the output terminal of the Fahrenheit to Celsius function to the Celsius output array.
This program uses the For Loop to select each element in the Fahrenheit input array, converts that value to Celsius and saves the results in the Celsius output array. Save the program as Fahrenheit to Celsius For Loop.vi and run the program.
The Celsius output array contains: Celsius {-17.7778, -6.6667, 4.44444, 15.5556, 26.6667, 37.7778, 48.8889, 60, 71.1111, 82.2222, 93.3333}
- 1392 reads