Create a program, Create a program tip – Rockwell Automation 1771-DB BASIC MODULE User Manual

Page 66

Advertising
background image

Chapter
Programming the BASIC Module

4

4 -2

BASIC Statements

BASIC statements are programming instructions that control program flow
or manipulate I/O and memory. Every statement begins with a line
number, followed by a statement body, and terminated with a carriage
return (CR) or a colon (:) in case of multiple statements per line number.
You execute statements automatically within a BASIC program during Run
mode. You can also enter these statements from the command line in
Command mode to test/evaluate the execution of the statement. Chapter
11 describes these statements in detail. Chapter 7 gives you an overview
of how to use the different types of statements.

BASIC Subroutines (CALLs)

BASIC system subroutines (calls) are programming instructions that you
execute within a BASIC program or from the command line. A call is
actually a type of statement. There are 128 calls. These calls perform such
activities as setting the clock/calendar, manipulating strings, processing
block transfers, and converting backplane data. Calls 0–127 are described
in detail in Chapters 12 and 13. Chapter 7 gives you an overview of how
to use the different types of calls.

BASIC module execution is controlled through a BASIC program residing
in RAM or ROM (memory module).

Remember these hints as you are programming:

Define strings first, unless you are executing a CALL 77 (page 13 -6).

Then, execute CALL 77 first and define your strings immediately after.

Dimension arrays after defining strings.

Define most used variables first. Use 0 until you assign real values.

When doing math, save intermediate values rather than recalculate.

Place the most used subroutines near the beginning of the program.

Straight through code executes faster, but uses more memory.

Put multiple statements on a line after debugging the program.

Comments use memory space and slow execution time.

After debugging the program save a fully commented copy on disk and
remove comments from the executable program.

Chapter

Chapter

Create a Program

Tip

Advertising