ASURO - 60 -
C for ASURO
If the program should be able to choose one option out of several alternatives, you may use
several “else if”-constructs.
if (Condition1)
Command_block_1
else if (Condition2)
Command_block_2
else if (Condition3)
Command_block_3
else if (Condition4)
Command_block_4
else
Command_block_5
The following conditional structures may be used:
Example:
#include “asuro.h”
int main(void) {
while (1) {
if (PollSwitch()>0) {StatusLED(RED);}
else {StatusLED(GREEN);}
}
}
If one of the collision detector switches has been activated, the status-LED will be switched on red,
otherwise in green. The other programming code will be explained later.
In the C-language a value “1” represents true and “0” represents false.
The conditional statement:
if (0) {StatusLED(RED);}
of course implies the command StatusLED(RED) will never be executed.
Operator
Explanation
==
comparision for equal
!=
comparision for unequal
<
comparision for less
>
comparision for greater
<=
comparision for less or equal
>=
comparision for greater or equal
Содержание 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...