Introduction to G programming language

G programming language is graphical language and is used for description of connections and relations between objects in block diagram. G language is different then textual language in many ways. First of all, program is executed linearly, meaning one by one command. The next command is executed after the previous has been finished, meaning that only one command is being executed at a time. G language has different characteristics. Since it is graphical language, linearity is excluded. One graphical block can be executed only when its inputs are defined or determined. That means it is possible to create a diagram with a few parallel branches, thus realizing simultaneous execution of numerous operations at the same time.

G programming language is complete programming language and offers usual structures, such as for and while loops, case structure, and a novelty which is not characteristic for text- oriented languages called sequence structure, which allows linear execution of certain parts of the program. That is very useful in situations similar to those when you first have to send some data to certain instrument, and then wait for a while and read the message that came from that instrument.

Each program written in G programming language is called virtual instrument. Drawing an icon creates virtual instrument, including defining inputs and outputs. It can also be included in other virtual instruments simply by importing the icon in program and connecting its inputs and outputs with other variables. That way it became sub-virtual instrument. Double click on that icon will open its front panel and block diagram.

Data types are presented with different colors and different shapes of connecting lines. Blue color presents integer, orange - float, purple - character, green - Boolean, etc. User defined types are presented with some other colors.

It is very important to notice that LabVIEW enables link with programs written in some other programming language. For example, you can always use C to program some "exotic" function.

In order to illustrate G programming language, here are some examples:

These were main facts about G programming language. Next important subject is connection between instrument and LabVIEW-a. That connection is possible through GPIB connection. The instrument doesn’t have to be directly connected with its main GPIB computer. It can be connected on Internet through GPIB-ENET module and that way it can also be contacted through the net.