
ASURO - 58 -
C for ASURO
Declaration of variables may be provided as global variable outside the main()-function or as a
local variable inside the main()-function. Global variables will be valid in the complete program
area. Local variables will be valid inside the main()-function or any other function only. They will
be valid for the programming code inside the function and they will be invalid outside the function.
Variables are rather useless, as long as we are unable to fi ll them with data. Assigning data is
however rather easy:
a=17; // variable a contains a value 17
or alternatively in a calculation:
a=17+23;
// variable a contains a value 40
Speed=a+3;
// variable Speed contains a value 43
Speed=Speed*2; // variable Speed contains a value 86
It is good programming practice to use clear understandable names. The variable name “speed” in
this example is self-explainable. Using simple letters as a variable should be restricted as it often
results in “unreadable” programming code.
The following example may demonstrate a simple, complete programming source:
#include “asuro.h”
int main(void) {
int i;
// i may contain numbers between -32768 and 32767
char any_token;
// variable any_token may contain ASCII-symbols or
// numbers between -128 and 127
i=3;
any_token =17+i; // any_token will now be assigned 20
i=i/2;
// Division by 2, will always be rounded down
// therefore i will now be assigned 1!
return 0;
}
A few interesting shortcuts are useful in the programming language C, e.g.:
i=i+1;
may also be written as:
i++;
Equally:
i=i-1;
may be written as:
i--;
Summary of Contents for DLR ASURO
Page 36: ...ASURO 36 Software Now this screen will show up Click I Agree This screen appears Click Next...
Page 37: ...ASURO 37 Software The next screen appears Click Install and the next screen appears Wait...
Page 40: ...ASURO 40 Software Select on the rigth side C C C C is selected Click Add to insert a new tool...
Page 45: ...ASURO 45 Software Just for try we will open the file C ASURO_src FirstTry test c Click Open...
Page 74: ...ASURO 74 B ASURO DIAGRAM Appendices...
Page 75: ...ASURO 75 Appendices C RS 232 Transceiver...
Page 76: ...ASURO 76 D USB Transceiver Appendices...
Page 77: ...ASURO 77 E Block diagram ASURO F Block diagram PIC processor Appendices...