Техническая Спецификация для C Control I programmer/evolution Board 8-12 Vdc Inputs / outputs - Program memory 2 kB 198302

Модели
198302
Скачать
Страница из 40
54
Using a Digital Port as Input
Digital inputs are used to query switching states. If a digital port is used as input, it
maintains an undefined level in an unswitched state that has to be defined with a
PULLUP resistance, for example.  For example, if a reed contact is connected to this
port, a logical 1 ("true") is read off the port with open switch and a logical 0 ("false")
with closed switch.
Make absolutely certain that the input value must possibly be inverted (NOT opera-
tor, see command description) depending on the switching of the port and the logi-
cal statement your program is supposed to contain. 
ATTENTION!
Never use Port 3 in applications where it is not sure that Port 3 is log. high when
applying the operating voltage. Otherwise, the download mode is active and
the user program does not run.
Using a Digital Port as Output
If a digital port is used as output, the subsequent ICs, transistors or low-current
LEDs can be operated directly. The maximum admissible load current is 10 mA. In
any case, you have to ensure a sufficient current limiting, e.g. through a resistor, oth-
erwise the microcontroller may be destroyed! 
Within the microcontroller, the internal assignment of a digital port as output or input
takes place during the first execution of the user program. After switching the oper-
ating voltage or after a reset, all digital ports initially behave as inputs electronically,
meaning they maintain high level via a pullup-resistor. 
Analogue Ports
With the C-Control MICRO, not all ports can assume the function of an analogue
port.
The available analogue ports are PORT1, PORT2, PORT5, PORT6.
Other ports are accepted by the development environment (in order to maintain the
compatibility to C-control I), but their use leads to absolutely uncontrollable behav-
iour of the MICRO.
A/D Converters
The C-Control MICRO does not have an own reference voltage. The operating volt-
age (5 V) serves as reference for the AD converters. Voltage stabilisers provide this
with adequate accuracy (+-5%).
If you have higher demands on the accuracy of the AD converters, you must provide
the 5V operating voltage with the corresponding accuracy. 
The applied voltage value is the top limit of the measuring range of the A/D conver-
sion and corresponds to the conversion value 255 (SFF hexadecimal). 
The ground potential (ground "minus") of the operating voltage always serves as ref-
erence for the lower limit of the measuring range of A/D conversion. You can connect
sensors of any kind to the A/D ports that provide an output voltage of 0 to 5 Volt. In
27
Anweisungen zur Steuerung des Programmflusses
• Schleife
FOR variable = anfang TO ende STEP schrittweite
. . .
NEXT
Die FOR-Schleife führt die Anweisungen bis zum NEXT solange aus, bis der Wert der
variable gleich dem Wert des Terms ende ist. Vor dem ersten Durchlauf wird der
Wert des Terms anfang berechnet und der Schleifen-variablen zugewiesen. In jedem
Durchgang wird der Wert des schrittweite- Terms zur Schleifenvariablen addiert. In
der Form
FOR variable = anfang TO ende STEP schrittweite
. . .
NEXT
beträgt die Schrittweite konstant 1. Die Werte des ende-Terms und des schrittweite-
Terms werden mit jedem
Schleifendurchlauf neu berechnet. Das gestattet eine erweiterte Kontrolle des Pro-
grammverlaufes.
Eine Schleife wir auf jeden Fall mindestens einmal durchlaufen, auch wenn anfang
und ende gleiche Werte haben
FOR-Schleifen können ineinander verschachtelt werden. Die Verschachtelungstiefe
ist nur durch den für die Schleifenvariablen erforderlichen Speicherplatz beschränkt.
FOR variable = anfang TO ende1
FOR variable = anfang TO ende2
FOR variable = anfang TO ende3
.......
NEXT
NEXT
NEXT
Jede FOR-Schleife darf im Verlauf des Programms nur über ihre eigene NEXT-
Anweisung laufen. Folgender Quelltext kann zwar compiliert und in den Steuercom-
puter geladen werden, wird jedoch nicht wie vielleicht
erwartet funktionieren: