FIGURE 3
at
www.servo
magazine.com.
To make the explanation of the block diagram easier to follow, I divided the diagram into seven blocks or functional areas
as shown in Figure 2. These seven boxes have no programming significance — they are for explanation purposes only.
Block 1 (Figure 3) is the initialization block; this is code that is
executed as soon as the VI is first run. Block 1 clears the
waveform chart of any previous chart traces. It also initializes
the cycle count to one and makes sure that the heat and the
fan are off. The VI will stay in this while loop until the
START/RUN button is pressed. Block 2 (Figure 4) is a three-channel analog input acquiring the LM34 voltage from
inside the chamber, the LM34 voltage from outside of the
chamber, and the LDR voltage. The LM34 voltages are
multiplied by 100 because the device outputs 10 mV per °F.
The inside temperature is then sent down into Block 6
where the lights and fan are cycled off and on; it is also
sent to the chart for graphing. Block 3 (Figure 5) is the
timing block; its main component is the elapsed time icon
which controls when the system changes from the upper
temperature cycle to the lower temperature cycle. The
elapsed time icon is set by the TIME IN MIN control to the
left that is then multiplied by 60 to convert
minutes into seconds (since the time base for the
elapsed time icon is in seconds).
A signal coming from the right side of the
elapsed time icon outputs a true pulse (the green
wire) when the elapsed time equals the set time
supplied by the TIME IN MIN control from its left
side. This pulse is then sent down into Block 6 to
control switching between the upper and lower
52 SERVO 07.2009
temperature cases. It is also sent to the right
FIGURE 4
into Block 5 (Figure 6) toincrement the cycle
counter each time the elapsed time icon times
out. Block 4 (Figure 7) cacquires the digital
condition of the shutter and lid switches, and
controls the shutter and open lid LEDs on the
front panel. (Block 6 will be explained in the
next section.) Block 7 (Figure 8) executes
when the while loop (main program loop) is
exited by either a press of the STOP button or
when the desired number of cycles equals the
executed number of cycles. This section turns
off the lights and fan, and resets the
START/RUN button. This block can be used to
illustrate why NI recommends that users avoid
using the abort execution icon versus using
controls in your VI that will terminate
FIGURE 5 structures such as while loops. If the user
presses the abort execution to stop the VI, the
fan and lights will remain on if they were on
when the program stops. However, if the
STOP button connected to the main while
loop is pressed, the VI’s code will complete all
code execution (including the code in Block 7)
and turn the lights and fan off before quitting.
Block 6 is a select case structure with
two cases: the true case is for the upper
temperature cycle (Figure 9) and the false case is for the lower
temperature cycle (Figure 10).
When the VI is first initiated, the program will start the
heater and heat the chamber up to the upper temperature.
The elapsed timer from Block 3 causes the case structure to
change cases each time it times out. In the true case, if the
actual temperature is less than the upper set temperature the
heater will be on. Also, the fan is disabled in this case and the
upper LED is turned on and the lower LED is turned off. In the
false case (Figure 10) — the lower temperature case — if the
actual temperature is greater than the lower set temperature,
the fan will be turned on. However, the heater will only turn on
FIGURE 6
FIGURE 8
FIGURE 7