User manual

ASURO - 56
-
9. C for ASURO
This chapter is devoted to the programming language C, but explanation will be limited to the
elements which are needed to control the ASURO system. Obviously the explanation is not a
complete C-manual, for which other literature may be found on the market
1
.
C has been chosen for its widespread standard and because a C-Compiler is available for almost
every processor. For ASURO we selected the Gnu-C-Compiler, a freeware program, which
generates a well optimized code for ASUROs ATmega8 processor.
Whoever is familiar with C will not read anything new in this part of the manual and may proceed
reading chapter 9.2.
We will describe selected elements, absolutely necessary for the ASURO
control.
Don’t worry: If you take care to use brackets and semicolons, the language C is not too dif cult at
all. And of course the ASURO is not a toy!
9.1. Basics in C-Programming
9.1.1. Introduction
Basically the processor executes commands in a C-program step by step from the beginning to
the end of the program
2
. Parallel processing cannot be provided in ASUROs standard processor,
so we will have to think in sequential working commands.
Empty spaces at the beginning of lines in examples, are simply structural reading aids and may be
left out. Inset spaces however provide excellent programming structure and are extremely helpful
keeping an overview in extended programs.
In C each command has to be completed with a semicolon “;”, enabling the compiler to assign all
elements to the correct command. If commands are to be joined in functions, loops or conditional
statements, this set of commands will be grouped by placing it inside a pair of special brackets
(“{”, “}”).
Example:
#include “asuro.h”
int main(void) {
/* All elements between these brackets belong to one set of commands */
}
1
For Example: Brian W. Kerninghan, Dennis M. Ritchie: “Programming in C”,
2
Methods to deviate from sequential control in programs ar being named „ ow control“ and will be
described in a later chapter.