ASURO - 62 -
9. C für ASURO
“while(1)” is equivalent to “for(;;)”, and both are eternal loops as the abort condition (in this case a
value 0) will never be reached.
Another loop sequence is a “do”-loop
do
command block
while( condition);
In contrast to a “while”-loop the condition will be checked after the command block. This
programming sequence forces the command block to be executed at least one time.
9.1.6. Functions
A defi nition block for a function always looks like:
Functions type Functions Name (ParameterType1 ParameterName1,
ParameterType2 ParameterName2, ...)
Really great, defi nition blocks for a function! Why so complicated???
Well, they are very useful, but their explanation is rather complex and may be postponed...
Sometimes we need to use the same programming sequences at different locations in our
programs. Of course we might repeat the writing or use a copy/paste-method for this purpose (this
is an annoying procedure and turns our program into a mess) or we just defi ne a funtion.
Now sometimes we need to pass a few variables to a function, eg. telling our
GoAhead
()
-function
to use a given speed exactly, a certain lapse of time or a defi ned distance. We will use parameters
for these details.
Sometimes a function will even return a value. A good example is the
HowManySwitchesHaveBe
enActivated
() -Function, returning a value, which will be defi ned somehow and somewhere within
the function-block. The value is returned by a
return
-command at the end of the function-body.
That’s why functions end with
return;
or
return number
;.
A special function is the
main ()
-function, defi ning the main body of a program. In ASURO the
main ()
-function will be executed at switching ON. Of course
every program must
be supplied
with a
main ()
-function.
Содержание DLR ASURO
Страница 36: ...ASURO 36 Software Now this screen will show up Click I Agree This screen appears Click Next...
Страница 37: ...ASURO 37 Software The next screen appears Click Install and the next screen appears Wait...
Страница 40: ...ASURO 40 Software Select on the rigth side C C C C is selected Click Add to insert a new tool...
Страница 45: ...ASURO 45 Software Just for try we will open the file C ASURO_src FirstTry test c Click Open...
Страница 74: ...ASURO 74 B ASURO DIAGRAM Appendices...
Страница 75: ...ASURO 75 Appendices C RS 232 Transceiver...
Страница 76: ...ASURO 76 D USB Transceiver Appendices...
Страница 77: ...ASURO 77 E Block diagram ASURO F Block diagram PIC processor Appendices...
Страница 78: ...ASURO 78 G Contents ASURO KIT Appendices...