Statement List Program Example (GS 5.4)

The example program below shows formatting in the STL editor according to the guidelines given in How to Enter a Statement in STL. You might want to set up your program similarly, by having the network comments give a general overview of the function of the network and the statement comments identify the function of the statement. Note that the sample is written with symbolic addresses.

If you would like to see this program (in either STL or LAD) in STEP 7-Micro/WIN 32, select File>Open, browse to the Microwin\Samples\English directory, highlight the sample program and click on the "Open" button.

Sample Program for a Paint Mixer

NETWORK 1 //Fill the tank with ingredient 1 and monitor tank level.
    //Maintain Pump Status if Start Switch Opens.
LD Start_1 //Load value of Start_1 I0.0.
O Pump_1 //Or with Pump_1 Q0.0 value.
A Stop_1 //And with Stop_1 I0.2.
AN High_Level //And Not with High_Level I0.4.
= Pump_1 //Assign result to Pump_1 Q0.0.
NETWORK 2 //Fill the tank with paint ingredient 2 and monitor tank.
    //level. Maintain Pump Status if Start Switch Opens.
LD Start_2 //Load value of Start_2 I0.1.
O Pump_2 //Or with Pump_2 Q0.1 value.
A Stop_2 //And with Stop_2 I0.3.
AN High_Level //And Not with High_Level I0.4.
= Pump_2 //Assign result to Pump_2 Q0.1.
NETWORK 3 //Set memory bit if High Level is reached.
LD High_Level //Load value of High_Level I0.4.
S High_Lev_Reached, 1 //Set High_Lev_Reached M0.1 to 1 (on).
NETWORK 4 //Start Timer if High Level is reached.
LD High_Lev_Reached //Load value of High_Level_Reached M0.1.
TON Mix_Timer, +100 //Timer 37, Preset = 100 (@0.1 s).
NETWORK 5 //Turn on Mixer Motor.
LDN Mix_Timer //Load Not value of Mix_Timer T37.
A High_Lev_Reached //And with High_Lev_Reached M0.1.
= Mixer_Motor //Assign result to Mixer_Motor Q0.2.
= Steam_Valve //Assign result to Steam_Valve Q0.3.
NETWORK 6 //Drain mixing tank.
LD Mix_Timer //Load value of Mix_Timer T37.
AN Low_Level //And Not with Low_Level I0.5.
= Drain_Valve //Assign result to Drain_Valve Q0.4.
= Drain_Pump //Assign result to Drain_Pump Q0.5.
NETWORK 7 //Count each cycle.
LD Low_Level //Load value of Low_Level I0.5.
A Mix_Timer //And value of Mix_Timer T37.
LD Reset //Load value of Reset I0.7.
CTU Cycle_Counter, +12 //Counter 30, Preset = 12.
NETWORK 8 //Reset memory bit if Low Level reached and Timer

//timed out.

LD Low_Level //Load value of Low_Level I0.5.
A Mix_Timer //And value of Mix_Timer T37.
R High_Lev_Reached, 1 //Reset value of High_Lev_Reached M0.1 to 0.