C Control I Micro-PCB 5 V/DC, 12 Vdc Inputs / outputs 1 x digital I/O / 1 x digital input / 4 x digital I/O or analogue 198289 데이터 시트

제품 코드
198289
다운로드
페이지 41
22
Probleme sogar Grundvoraussetzung. Anweisungen zur Steuerung des Programm-
flusses bestehen aus einem oder mehreren reservierten Worten und erfordern in
jeweils spezieller Weise eventuell weitere Angaben.
GOTO labell
IF a > b THEN GOSUBlabel2
FOR i = 0 TO 10 STEP 2
. . _
NEXT
Compileranweisungen
Zusätzlich zu den Programmanweisungen enthält ein CCBASIC-Quelltext Compiler-
anweisungen, die zum Beispiel zum Anlegen von Datenblocks (Tabellen) oder zur
Definition von Variablen- und Konstanten dienen.
Für Compileranweisungen gilt die Doppelpunktregel zum Trennen mehrerer Anwei-
sungen in einer Zeile nicht. Es darf jeweils nur eine Compileranweisung in einer Zeile
stehen. Die DEFINE-Anweisung ist eine Compileranweisung.
Definition symbolischer Konstanten
Es ist guter Programmierstil, statt ,,magischer” Zahlen im Programm
IF x > 123 THEN GOTO alarm
besser symbolische Konstanten zu verwenden. Durch Vergabe signifikanter Bezeich-
ner für Konstanten erhöht sich die Lesbarkeit des Quelltextes. Wenn alle Konstanten
global definiert werden, ist ein Programm auch leichter zu warten. Das gilt besonders,
wenn ein und dieselbe Konstante mehrmals im Programm benötigt wird.
Die Definition einer symbolischen Konstanten erfolgt wie folgt:
DEFINE bezeichner wert
Dabei ist wert entweder eine dezimale, hexadezimale oder binäre Zahl. So sollte das
Beispiel zuvor besser
DEFINE limit 123
. . .
IF x > limit THEN GOTO alarm
lauten.
Definition von Variablen
Der C-Control/BASIC MICRO Steuercomputer stellt 24 Byte-Speicherzellen seines
internen Speichers (RAM) dem Anwender zur Verwendung in seinen Programmen
zur Verfügung. In diesem Speicherbereich werden alle Variablen eines BASIC-Pro-
59
Assignments
The assignment is the simplest form of a program instruction. After the identifier of a
variable to which a value is to be assigned, the assignment symbol "=”follows and
then a term which determines the value to be assigned. An assignment thus corre-
sponds to a simple mathematical formula.
a = 10
b =x -y
c = (a*a + b*b)
Commands
Alongside simple assignments, commands are instruction  for the execution of pro-
gram operations by the C-control/BASIC control computer. Commands always
begin with a reserved value. Some commands expect one or more parameters for
precise specification of the program operation to be executed. These parameters are
listed after the command identifier and a blank, and thereby separated by a comma
(exception PRINT, see general view of commands). Contrary to the arguments for
calling up a function, the command parameters are not positioned outside round
brackets.
PAUSE 100
BEEP 140,50,BEEPER
Instruction for controlling the program flow
These instructions allow the order of the in fact strictly sequentially processed pro-
gram operations to be controlled and adapted to the input values of the information
processing process. They offer a high degree of flexibility for algorithm formulation
and are indeed a basic prerequisite for the solution of some technical application
problems. Instructions for the control of the program flow consist of one or more
reserved values and possibly require further information each in a special manner. 
GOTO labell
IF a > b THEN GOSUBlabel2
FOR i = 0 TO 10 STEP 2
. . _
NEXT
Compiler instructions
Additionally to the program instructions, a CCBASIC source text contains compiler
instructions which, for example, serve the creation of data blocks (tables) or the def-
inition of variables and constants.
The colon rule does not apply to compiler instructions for the separation of several
instruction in one line. There may be only one compiler instruction in one line. The
DEFINE instruction is a compiler instruction.