Iq programming structure, Introduction, Program structure – Rockwell Automation 1398-PDM-xxx IQ Master Version 3.2.4 for IA-2000 and IQ-5000 Positioning Drive Modules, IQ-55 User Manual
Page 163: Title, Header

141
Publication 1398-PM601A-EN-P — October 2000
TUTORIAL
IQ Programming Structure
Introduction
One of the most important aspects of programming is developing a structure for the program. Before you
begin to write a program you should develop a plan for that program. What tasks must be performed? In
what order do they need to be performed? What things can be done to make the program easy to understand
and to be maintained by others? Are there any procedures that are repetitive? The answers to these questions
and the programming techniques presented in this section will help you to develop a bug free program that
can be maintained and enhanced in the future.
Most programs are not a simple linear list of instructions where every instruction is executed in exactly the
same order each time the program is run. Programs need to do different things in response to external events
and operator input. IQ Basic contains Program Structure instruction, scanned event functions, Xkey func-
tions, Fkey functions, and interrupt functions that may be used to control the flow of execution in an applica-
tion program.
Program Structure instructions are instructions that cause the program to change the path of execution.
Scanned events are instructions that execute at the same time as the main body of the application program.
Xkey and Fkey routines are routines that execute in response to an operator pressing keys on the operator
terminal. Interrupts are instructions that execute quickly in response to select inputs to the IQ.
Program Structure
IQ programs are divided into five distinct sections: Title, Header, Main Body, Subroutines, and End. These
sections must be in the order outlined below.
Title
TITLE "example" ;Title of the program
Header
PGMTYPE = ...;Compiler Options statements
ASSIGN name Vn;Variable name assignments
S1:IF condition action;Scanned events