Quentin LAM
/
ex26
Exo
main.cpp@0:423cc5f68c56, 2018-05-29 (annotated)
- Committer:
- Quent1nl
- Date:
- Tue May 29 14:16:00 2018 +0000
- Revision:
- 0:423cc5f68c56
EX26
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Quent1nl | 0:423cc5f68c56 | 1 | #include "Nboard.h" |
Quent1nl | 0:423cc5f68c56 | 2 | |
Quent1nl | 0:423cc5f68c56 | 3 | |
Quent1nl | 0:423cc5f68c56 | 4 | IHM ihm; |
Quent1nl | 0:423cc5f68c56 | 5 | |
Quent1nl | 0:423cc5f68c56 | 6 | int main() |
Quent1nl | 0:423cc5f68c56 | 7 | { |
Quent1nl | 0:423cc5f68c56 | 8 | UINT16 val,pota,decal; |
Quent1nl | 0:423cc5f68c56 | 9 | float pot; |
Quent1nl | 0:423cc5f68c56 | 10 | while(1) { |
Quent1nl | 0:423cc5f68c56 | 11 | BusSelMux=Ana7; |
Quent1nl | 0:423cc5f68c56 | 12 | wait_us(1); |
Quent1nl | 0:423cc5f68c56 | 13 | val=AnaIn.read_u16(); |
Quent1nl | 0:423cc5f68c56 | 14 | pot=AnaIn.read(); |
Quent1nl | 0:423cc5f68c56 | 15 | pota=val; |
Quent1nl | 0:423cc5f68c56 | 16 | decal=val; |
Quent1nl | 0:423cc5f68c56 | 17 | pota=pota>>4; |
Quent1nl | 0:423cc5f68c56 | 18 | ihm.LCD_gotoxy(0,0); |
Quent1nl | 0:423cc5f68c56 | 19 | ihm.LCD_printf("POT=%04X=%3.2f",val,pot); |
Quent1nl | 0:423cc5f68c56 | 20 | ihm.LCD_gotoxy(1,0); |
Quent1nl | 0:423cc5f68c56 | 21 | ihm.LCD_printf("POT=%X=%5d",pota,pota); |
Quent1nl | 0:423cc5f68c56 | 22 | decal=decal>>8; |
Quent1nl | 0:423cc5f68c56 | 23 | //Bus8Leds=decal; |
Quent1nl | 0:423cc5f68c56 | 24 | if(pot==0.5){ |
Quent1nl | 0:423cc5f68c56 | 25 | Bus8Leds=0x0F; |
Quent1nl | 0:423cc5f68c56 | 26 | } |
Quent1nl | 0:423cc5f68c56 | 27 | if(pot>=0.75){ |
Quent1nl | 0:423cc5f68c56 | 28 | Bus8Leds=0x3F; |
Quent1nl | 0:423cc5f68c56 | 29 | } |
Quent1nl | 0:423cc5f68c56 | 30 | else{ |
Quent1nl | 0:423cc5f68c56 | 31 | Bus8Leds=0x00; |
Quent1nl | 0:423cc5f68c56 | 32 | } |
Quent1nl | 0:423cc5f68c56 | 33 | } |
Quent1nl | 0:423cc5f68c56 | 34 | } |