Step-by-step development of an example project
105724_en_01 PHOENIX CONTACT 47
Figure 5-20 on page 46 illustrates the “FirstSteps_ILC131.mwe” example program
described in this section.
– In the top part of the program, a clock is generated. There are two clock frequencies that
can be selected.
– In the middle part, the clock is ANDed with an input signal from the controller. When the
input signal is present, the clock signal is switched through to a controller output.
– In the lower part, an analog input signal (adjustable voltage) from voltage input channel
1 of the Inline input terminal is connected to an analog value variable.
The clock frequency is set according to the positions of switches 0 and 1 of the switch
module. This is indicated by the Q1 LED.
In addition, the switch positions of switches 0 to 7 of the switch module are indicated using
LEDs I1 to I8 of inputs 1 to 8 of the controller.
Variables in the program The entire program is implemented in the POU “Main”. The ONBOARD_INPUT_BIT0 to
ONBOARD_INPUT_BIT7 (system variables; ONBOARD_INPUT_BIT0 and
ONBOARD_INPUT_BIT1 are used in the program) map the status of the inputs to which
the toggle switches are connected. The Input_Analog variable (user variable) maps the
status of the analog input to which the adjustable voltage is supplied.
Within the POU “Main”, the clock speed is set according to the ONBOARD_INPUT_BIT0
and ONBOARD_INPUT_BIT1 input variables. In addition, the clock signal is generated
(clock) and output to a controller output (ONBOARD_OUTPUT_BIT0). An analog input
value (Input_Analog variable) is also connected to an internal program variable
(Output_Analog).
The basic steps for creating this program are described below.
Visualization The “FirstSteps_ILC131.prj” example visualization can be used to display the states of the
controller LEDs and the states of LEDs for the switch module in your web browser. The state
of the analog input signal is displayed as a bar graph.
For more information about installing and starting up the example visualization on the
controller and the requirements for your web browser, refer to Section 7, “Visualization
with WebVisit”.