Chapter 7 Application Programming 121
Overview ............................................................................................................................... 121
Using the DOS Editor to Enter Programs (DMC-2000 only) ................................................ 121
Edit Mode Commands............................................................................................. 122
Example................................................................................................................... 122
Program Format.....................................................................................................................123
Using Labels in Programs .......................................................................................123
Special Labels..........................................................................................................123
Commenting Programs............................................................................................124
Executing Programs - Multitasking ....................................................................................... 125
Debugging Programs .............................................................................................................126
Trace Commands ( DMC-2100/2200 only).............................................................126
Error Code Command.............................................................................................. 127
Stop Code Command............................................................................................... 127
RAM Memory Interrogation Commands ................................................................ 127
Operands.................................................................................................................. 127
Example................................................................................................................... 127
Program Flow Commands ..................................................................................................... 128
Event Triggers & Trippoints....................................................................................128
Conditional Jumps...................................................................................................132
If, Else, and Endif.................................................................................................... 134
Subroutines..............................................................................................................136
Stack Manipulation.................................................................................................. 136
Auto-Start Routine ..................................................................................................136
Automatic Subroutines for Monitoring Conditions ................................................. 137
Mathematical and Functional Expressions ............................................................................ 142
Mathematical Operators ..........................................................................................142
Bit-Wise Operators.................................................................................................. 142
Functions .................................................................................................................144
Variables................................................................................................................................144
Programmable Variables ......................................................................................... 145
Operands................................................................................................................................146
Special Operands (Keywords).................................................................................146
Arrays .................................................................................................................................... 147
Defining Arrays....................................................................................................... 147
Assignment of Array Entries ................................................................................... 147
Uploading and Downloading Arrays to On Board Memory.................................... 148
Automatic Data Capture into Arrays ....................................................................... 148
Deallocating Array Space........................................................................................ 150
Input of Data (Numeric and String)....................................................................................... 150
Input of Data............................................................................................................ 150
Operator Data Entry Mode ......................................................................................151
Using Communication Interrupt.............................................................................. 152
Output of Data (Numeric and String) ....................................................................................153
Sending Messages ................................................................................................... 154
Displaying Variables and Arrays............................................................................. 155
Interrogation Commands.........................................................................................155
Formatting Variables and Array Elements .............................................................. 157
Converting to User Units.........................................................................................158
Hardware I/O ......................................................................................................................... 158
Digital Outputs ........................................................................................................ 158
Digital Inputs...........................................................................................................159
The Auxiliary Encoder Inputs .................................................................................160
Input Interrupt Function .......................................................................................... 160
Analog Inputs ..........................................................................................................161
DMC-2x00 Contentsy v