You are here


26 July, 2019 - 09:47
Available under Creative Commons-ShareAlike 4.0 International License. Download for free at

This G program shows how G allows programmers to develop interactive programs. Create the following G program and wire it as shown in the figure below.

Figure 1.77 Creating Interactive Programs 

In the Front Panel window, from the Functions » Modern » Numeric select the vertical pointer slide. From the Functions » Modern » Graph select Waveform Chart.

Figure 1.78 Vertical Pointer Slide and Waveform Chart  

Re-label the vertical pointer slide as Amplitude and the waveform chart as Sine Wave. Re-arrange to GUI to look like the figure below.

Figure 1.79 Slide & Waveform Chart in Front Panel window  

Right click on Sine Wave and selectProperties from the pop-up menu.

Figure 1.80 Selecting Chart Properties 

Select the Scales tab and change Maximum to 1023. Sine Wave will display 1024 samples. Click on the down arrow located to the right of Time (XAxis) and select Amplitude (YAxis).

Figure 1.81 X-Axis Maximum 
Figure 1.82 Selecting Y-Axis 

De-select Autoscale and change the Minimum and Maximum values to -10 and 10. Click OK.

De-Selecting Autoscale


In the Block Diagram window, re-arrange the Amplitude and Sine Wave terminals and finish the program as shown in Interactive Sine Wave Diagram.

Figure 1.83 Interactive Sine Wave Diagram 

Scroll the mouse pointer over the Loop Control...

Figure 1.84 Loop Condition 

And right click on theLoop Control and from the pop-up menu selectCreate Control. A stop terminal is created...

Figure 1.85 Create Loop Control 
Figure 1.86 Interactive G Program 

With the correspondingstop Boolean input control. Save the G program as

Figure 1.87 Interactive Program  

Run the G program.

Figure 1.88 Interactive Program 

While the program is running, change the Amplitude and watch the graph update to refect the interactive changes.

Figure 1.89 Interactive Program 

To end the G program, simply click on the stop button. Congratulations. You have successfully completed and executed your first interactive G program.

Figure 1.90 Interactive Program