Let’s startup Studio 5000, and select the program RealPars_IEC61131, previously created in the first section.
After the Studio 5000 program starts up, the “Logic Designer GUI” appears. In the “Controller Organizer Area” - “Tasks” folder - “MainProgram” folder, we can see the three different program file types created in the first section, they are:
The ladder routine was created in the previous section so now let’s continue where we left off and work on the Structured Text routine.
We will program while online with the processor so let’s download the program to the “Emulator PLC”.
Next, under the “MainProgram” folder, double left-click on the “RealPars_StructuredText” routine. Select the “Edit” icon.
When the blank routine window is displayed, we will copy/paste or type the sample “Structured Text” script in the routine window:
// Let's begin Structured Text Sample
If SoftWaterTank.TankLevel >= SoftWaterTank.PumpStart_SP then /*Check Tank level for Pump Start SP Level */
SoftWaterTank.PumpStarter:= 1; /* Turn Pump ON */
SoftWaterTank.WaterValve:= 1; /* OPEN Water Valve */
ElsIf SoftWaterTank.TankLevel <= SoftWaterTank.PumpStop_SP then /*Check Tank level for Pump Stop SP Level */
SoftWaterTank.PumpStarter:= 0; /* Turn Pump OFF */
SoftWaterTank.WaterValve:= 0; /* CLOSE Water Valve */
After we paste or type the sample “Structured Text”, the window displays the coded text.
With the “Structured Text” routine, we will use an “If-Then-Else” function. The “If” statement will perform the comparison using the “greater than or equal” (>=) and “less than or equal” (<=) symbols.