User Guide
Table Of Contents
- Table of Contents
- How to Use This Manual
- Chapter 1–Program Methodology
- Overview
- Introduction to PPCL
- PPCL Rules
- PPCL Program Design Guidelines
- Relational Operators
- Logical Operators
- Arithmetic Operators
- Arithmetic Functions
- Special Functions
- Order of Precedence
- Resident Points
- Local Variables
- Point Priority Overview
- At (@) Priority Status Indicators
- Point Status Indicators
- Converting a Sequence of Operation intoProgram Code
- Chapter 2–Control OptionComparisons
- Chapter 3–Command Syntax
- Overview
- ACT (Activate lines)
- ADAPTM (Adaptive control, multiple)
- ADAPTS (Adaptive control, single)
- ALARM (Alarm state)
- AUTO (Auto status)
- DAY (Day mode)
- DBSWIT (Dead band switch)
- DC (Duty cycle)
- DCR (Duty cycle routine)
- DEACT (Deactivate lines)
- DEFINE (Define abbreviation)
- DISABL (Disable lines)
- DISALM (Disable alarm)
- DISCOV (Disable COV)
- DPHONE (Disable phone)
- EMAUTO (Emergency, Auto status)
- EMFAST (Emergency, Fast status)
- EMOFF (Emergency, Off status)
- EMON (Emergency, On status)
- EMSET (Emergency, set value)
- EMSLOW (Emergency, Slow status)
- ENABLE (Enable lines)
- ENALM (Enable alarm)
- ENCOV (Enable COV)
- EPHONE (Enable phone)
- FAST (Fast status)
- GOSUB (Go to subroutine)
- GOTO (Go to line)
- HLIMIT (High limit)
- HOLIDA (Holiday)
- IF/THEN and IF/THEN/ELSE (Conditional control)
- INITTO (Initialize totalized value)
- LLIMIT (Low limit)
- LOCAL (Local variable)
- LOOP (Loop control)
- MAX (Maximum value)
- MIN (Minimum value)
- NIGHT (Night mode)
- NORMAL (Normal operating mode)
- OFF (Off status)
- OIP (Operator interface program)
- ON (On status)
- ONPWRT (On after power return)
- PDL (Peak demand limiting)
- PDLDAT (PDL, define load attributes)
- PDLDPG (PDL, digital point group)
- PDLMTR (PDL, meter monitor)
- PDLSET (PDL, setpoints)
- RELEAS (Release)
- RETURN (Return/end subroutine)
- SAMPLE (Sample a statement)
- SET (Set point value)
- SLOW (Slow status)
- SSTO (Start/stop time optimization)
- SSTOCO (SSTO coefficients)
- STATE (State text command)
- TABLE (Table of coordinates)
- TIMAVG (Average over time)
- TOD (Time of day, digital points)
- TODMOD (TOD modes)
- TODSET (Time of day, analog points)
- WAIT (Wait time)
- Overview
- Glossary
- Appendix A—PPCL Reserved WordList
- Index
Command Syntax
Siemens Building Technologies, Inc. 3-53
100 C MAINLINE PROGRAM FOR LOGICAL FIRMWARE
110 C LEARNING HOW TO USE GOSUB, RETURN, AND
112 C $ARG COMMANDS.***
120
130 GOSUB 1010
...
...
...
300 GOSUB 2010 PT1, PT2
...
...
...
400 GOTO 3000
1000 C --SUBROUTINE 1
1001 C THIS SUBROUTINE ASSIGNS NUMBERS
1002 C TO PT1 AND PT2. IT THEN RETURNS
1004 C CONTROL TO THE MAIN PROGRAM.
1008 C
1010 PT1 = 10
1020 PT2 = 20
1030 RETURN
2000 C --SUBROUTINE 2
2001 C THIS SUBROUTINE PASSES THE VALUE OF
2002 C PT1 AND PT2 TO THEIR RESPECTIVE $ARG
2003 C POINTS. IT THEN ADDS ONE TO BOTH $ARG
2004 C POINTS AND RETURNS THE NEW VALUES TO
2005 C PT1 AND PT2.
2006 C
2010 $ARG1 = $ARG1 + 1
2020 $ARG2 = $ARG2 + 1
2030 RETURN
3000 C WHEN THE SUBROUTINE IS FINISHED
3002 C EXECUTING, THE PROGRAM RETURNS TO
3004 C MAINLINE CODE.
Figure 3-1. Example Program with Two Subroutines.
APOGEE PPCL User’s Manual
3-54 Siemens Building Technologies, Inc.
Multiple-Level Subroutines
The following example demonstrates the use of $ARGn variables
and point declarations used in multiple-level subroutines.
This example demonstrates a method for preserving the values of
$ARGn variables as program control is transferred among
subroutines. The example program contains a main line section of
program code and three subroutines. Refer to Figure 3-2 as you
follow the program flow sequence.
The program flow through one complete pass is as follows:
1. At line 1500, the GOSUB command transfers control to line 2030
and passes the value defined in PT1 to $ARG1 in the
subroutine.
2. While executing the first subroutine, the program encounters a
call to a second subroutine at line 2500.
• Since the GOSUB command at line 2500 is defined within
another subroutine, this command must redefine $ARG1 in
order to preserve the value from the GOSUB command at
line 1500.
• If $ARG1 is not redefined in the call to the second
subroutine, any value introduced in the second subroutine
replaces the value in $ARG1.
• The new value introduced in the second subroutine (PT2 in
the example) is defined after the $ARG1 variable.
• As the program works with the variables $ARG1 and PT2 in
the second subroutine, $ARG1 continues to represent the
value of PT1, while $ARG2 represents the value of PT2.
3. At line 3200, the second subroutine calls a third subroutine.
• Sine the GOSUB command at line 3200 is defined within two
other subroutines, this command must redefine both $ARG1
and $ARG2 in order to preserve their values.
• Note that $ARG1 and $ARG2 are placed in the same order
in which they were originally defined.
• Line 3200 also defines a new point called PT3. Note that
PT3 is placed after the two $ARGn variables.