<< Chapter < Page Chapter >> Page >
A screen capture of a window with a grey grid enclosing two input or output boxes, labeled year, and message. A pop-out menu from the year box is visible, with the selection, representation, then word, then an object labeled I32 highlighted.
32-Bit Integer Numeric

Arrange the Year and Message terminals in the Block Diagram window as shown in the figure.

A three-part diagram connecting numbers to operations. The first is the number 4 inside a blue box that is connected with a line segment to an operation named quotient and remainder. To the right of the object is the operator, equal to 0. The second is the number 100 inside a blue box that is connected with a line segment to an operation named quotient and remainder. To the right of the object is the operator, not equal to 0. The third is the number 400 inside a blue box that is connected with a line segment to an operation named quotient and remainder. To the right of the object is the operator, equal to 0. In between the first and second parts is the, and, operator. In between the second and third parts is the, or, operator. To the right of these diagrams is a large rectangle, containing a drop-down menu labeled False. Inside the box is a pink rectangle containing the text, Is a Leap Year. To the far left of the diagrams is an object titled year, and to the far right is an object titled message.
Unwired Leap Year Diagram

Wire the OR operator is to the “?” in the case structure and the string constant “Is not a Leap Year” is wired to Message .

A three-part diagram connecting numbers to operations. The first is the number 4 inside a blue box that is connected with a line segment to an operation named quotient and remainder. To the right of the object is the operator, equal to 0. The second is the number 100 inside a blue box that is connected with a line segment to an operation named quotient and remainder. To the right of the object is the operator, not equal to 0. The third is the number 400 inside a blue box that is connected with a line segment to an operation named quotient and remainder. To the right of the object is the operator, equal to 0. In between the first and second parts is the, and, operator. In between the second and third parts is the, or, operator. To the right of these diagrams is a large rectangle, containing a drop-down menu labeled False. Inside the box is a pink rectangle containing the text, Is a Leap Year. To the far left of the diagrams is an object titled year, and to the far right is an object titled message. There are blue lines connecting year to each quotient and remainder operator, green lines connecting the operators together, then converging on a connector from the or operator to the large rectangle. Finally, there is a pink line connecting the large rectangle to an icon labeled, message.
Leap Year False Case

Select the True option and Wire the “Is a Leap Year” string constant to the output terminal of the Case Structure .

A three-part diagram connecting numbers to operations. The first is the number 4 inside a blue box that is connected with a line segment to an operation named quotient and remainder. To the right of the object is the operator, equal to 0. The second is the number 100 inside a blue box that is connected with a line segment to an operation named quotient and remainder. To the right of the object is the operator, not equal to 0. The third is the number 400 inside a blue box that is connected with a line segment to an operation named quotient and remainder. To the right of the object is the operator, equal to 0. In between the first and second parts is the, and, operator. In between the second and third parts is the, or, operator. To the right of these diagrams is a large rectangle, containing a drop-down menu labeled True. Inside the box is a pink rectangle containing the text, Is a Leap Year. To the far left of the diagrams is an object titled year, and to the far right is an object titled message. There are blue lines connecting year to each quotient and remainder operator, green lines connecting the operators together, then converging on a connector from the or operator to the large rectangle. Finally, there is a pink line connecting the large rectangle to an icon labeled, message.
Leap Year True Case

Save the program as Leap Year.vi , enter Year values and run the program to determine whether the value of Year is that of a leap year or not.

A screen capture of a grey grid containing an input and output box. The input box is labeled, year, and contains the value 2000. The output box is labeled, Message, and contains the text, is a leap year.
Leap Year Program

Arrays

Right click on the Front Panel window and select Array from the Controls>>Modern>>Arrays, Matrix&Cluster menu, and drop an array onto the Front Panel window. The array structure consists of an index or element offset (left portion of the structure) and the array elements (right portion of the structure). When the array structure is placed on the Front Panel window, the data type of the array is undefined as indicated by the grayed out portion of the array.

A two-part screenshot. The left side is a grey grid containing one white box, containing the value 0, and one larger grey box, labeled Array. The right side is a window titled, controls, containing a hierarchical list, beginning with Modern, and continuing with Array, matrix, and cluster. Below the list are two objects, labeled Array and Cluster.
Arrays

To define the array data type, drag and drop a data type onto the array structure. For instance, to create an input array of numbers, place Numeric Control into the array structure.

A two-part screenshot. The left side is a grey grid containing one white box, containing the value 0, and one larger grey box, labeled Array. Inside the grey box are dashed rectangles of different heights and widths. The right side is a window titled, controls, containing a hierarchical list, beginning with Modern, and continuing with Array, matrix, and cluster. Below the list are two objects, labeled Array and Cluster.
Creating a Numeric Array

At this point, the numeric array is an Empty or Null array because no elements of the array have been defined. This is indicated by the grayed out numeric control within the array structure.

A screen capture of a grey grid containing an input and output box. Both boxes contain values of 0, and the box is titled, Numeric Input Array.
Empty Numeric Array

Define elements of an input array by selecting the offset and entering its value. For instance, at offset = 4, enter the value 0.0. This defines Numeric Input Array as {0, 0, 0, 0, 0} .

A screen capture of a grey grid containing an input and output box. The box is titled, Numeric Input Array. The input box contains the value, 4, and the output box contains the value, 0.
Defining Numeric Array Elements

An output array is created similarly to an input array with the exception that an output data type needs to be dropped into the array structure.

A screen capture of a grey grid containing four boxes. The left two boxes are titled, Numeric Input Array. The right two boxes are titled, Numeric Output Array. All four boxes contain the value, 0.
Creating Output Numeric Arrays

For loop

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 offsets 0 through 10 as shown in [link] .

A screen capture of a grey grid containing four boxes. The left two boxes are titled, Fahrenheit, and the right two boxes are titled, Celsius. The leftmost box under fahrenheit contains the value, 10, and the right box under fahrenheit contains the value, 200. Both boxes under celsius contain the value, 0.
Numeric Input and Output Arrays

Right click in the Block Diagram window, navigate to Programming>>Structures and click on For Loop .

A screen cap of a window containing a directory hierarchy 'Programming' above 'Structures'. Contained in 'Structures' are two icons. On the left of the window there is an orange icon labeled 'Fahrenheit'.
For Loop Structure

Click and drag to create the For Loop as shown in [link] and [link] .

A dashed square is in the middle of this image. There is a smal dashed square containing an 'N'in the lower right corner of the square. On the left side of the square is an icon labeled 'Fahrenheit' and on the right side there is a similar icon labeled Celsius.
Creating For Loops
A dashed square is in the middle of this image. There is a smal dashed square containing an 'N'in the lower right corner of the square. On the left side of the square is an icon labeled 'Fahrenheit' and on the right side there is a similar icon labeled 'Celsius'.
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 click OK . Drop the function inside the For Loop .

From left to right there is an orange square labeled 'Fahrenheit' and then a big box with a blue box 'N' on the upper left corner and a blue box 'i' on the lower left corner. In the middle of the big box there is a small box containing 'Fahr to Celsius'. On the right side of the big box there is another icon labeled 'celsius'.
Function in Diagram

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.

From left to right there is an orange square labeled 'Fahrenheit' and then a big box with a blue box 'N' on the upper left corner and a blue box 'i' on the lower left corner. In the middle of the big box there is a small box containing 'Fahr to Celsius'. On the right side of the big box there is another icon labeled 'celsius'. An orange line runs from the right edge of the left icon through the center of the big box and connects to the left side of the right icon.
Wired Function in Diagram

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.

Two parallel forms. On the left there is form labeled 'Fahrenheit' with the values '7' and '140'. On the right is another form labeled 'Celsius' with the values '7' and '60'.
Fahrenheit to Celsius Arrays

Questions & Answers

what is the stm
Brian Reply
is there industrial application of fullrenes. What is the method to prepare fullrene on large scale.?
Rafiq
industrial application...? mmm I think on the medical side as drug carrier, but you should go deeper on your research, I may be wrong
Damian
How we are making nano material?
LITNING Reply
what is a peer
LITNING Reply
What is meant by 'nano scale'?
LITNING Reply
What is STMs full form?
LITNING
scanning tunneling microscope
Sahil
how nano science is used for hydrophobicity
Santosh
Do u think that Graphene and Fullrene fiber can be used to make Air Plane body structure the lightest and strongest. Rafiq
Rafiq
what is differents between GO and RGO?
Mahi
what is simplest way to understand the applications of nano robots used to detect the cancer affected cell of human body.? How this robot is carried to required site of body cell.? what will be the carrier material and how can be detected that correct delivery of drug is done Rafiq
Rafiq
what is Nano technology ?
Bob Reply
write examples of Nano molecule?
Bob
The nanotechnology is as new science, to scale nanometric
brayan
nanotechnology is the study, desing, synthesis, manipulation and application of materials and functional systems through control of matter at nanoscale
Damian
Is there any normative that regulates the use of silver nanoparticles?
Damian Reply
what king of growth are you checking .?
Renato
What fields keep nano created devices from performing or assimulating ? Magnetic fields ? Are do they assimilate ?
Stoney Reply
why we need to study biomolecules, molecular biology in nanotechnology?
Adin Reply
?
Kyle
yes I'm doing my masters in nanotechnology, we are being studying all these domains as well..
Adin
why?
Adin
what school?
Kyle
biomolecules are e building blocks of every organics and inorganic materials.
Joe
anyone know any internet site where one can find nanotechnology papers?
Damian Reply
research.net
kanaga
sciencedirect big data base
Ernesto
Introduction about quantum dots in nanotechnology
Praveena Reply
what does nano mean?
Anassong Reply
nano basically means 10^(-9). nanometer is a unit to measure length.
Bharti
do you think it's worthwhile in the long term to study the effects and possibilities of nanotechnology on viral treatment?
Damian Reply
absolutely yes
Daniel
how to know photocatalytic properties of tio2 nanoparticles...what to do now
Akash Reply
it is a goid question and i want to know the answer as well
Maciej
characteristics of micro business
Abigail
for teaching engĺish at school how nano technology help us
Anassong
How can I make nanorobot?
Lily
Do somebody tell me a best nano engineering book for beginners?
s. Reply
there is no specific books for beginners but there is book called principle of nanotechnology
NANO
how can I make nanorobot?
Lily
what is fullerene does it is used to make bukky balls
Devang Reply
are you nano engineer ?
s.
fullerene is a bucky ball aka Carbon 60 molecule. It was name by the architect Fuller. He design the geodesic dome. it resembles a soccer ball.
Tarell
what is the actual application of fullerenes nowadays?
Damian
That is a great question Damian. best way to answer that question is to Google it. there are hundreds of applications for buck minister fullerenes, from medical to aerospace. you can also find plenty of research papers that will give you great detail on the potential applications of fullerenes.
Tarell
how did you get the value of 2000N.What calculations are needed to arrive at it
Smarajit Reply
Privacy Information Security Software Version 1.1a
Good
Got questions? Join the online conversation and get instant answers!
Jobilize.com Reply

Get the best Algebra and trigonometry course in your pocket!





Source:  OpenStax, Introduction to g programming. OpenStax CNX. Mar 15, 2010 Download for free at http://cnx.org/content/col11192/1.1
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'Introduction to g programming' conversation and receive update notifications?

Ask