ASURO - 71 -
C for ASURO
9.2.12. unsigned char PollSwitch (void)
This function scans the position of switches (K1-K6) and returns one byte, containing information,
which switches have been activated. Switch 1 will set the fi rst bit number 5, switch 2 will set the
second bit, ... switch 6 will set bit number 5,
Bit0 (1) -> K6
Bit1 (2) -> K5
Bit2 (4) -> K4
Bit3 (8) -> K3
Bit4 (16) -> K2
Bit5 (32) -> K1
Activating switches 1,3 and 5 will cause the function to return 42 (32+8+2 = 42).
To be sure, the function may be called several times in sequence to provide a “correct” answer.
Capacitor C7 fi rst must be discharged, which may take some time. If you scan the A/D-converter
prematurely, some unreliable data may be delivered.
Example:
unsigned char taste;
.
.
switch = PollSwitch();
if (switch>0) {MotorSpeed(0,0);}
Well, that’s it. Now it’s up to you to be creative.
Содержание 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...