![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
KEIS
main.cpp@0:15183cd2c928, 2013-10-01 (annotated)
- Committer:
- khayakawa
- Date:
- Tue Oct 01 00:10:26 2013 +0000
- Revision:
- 0:15183cd2c928
KEIS
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
khayakawa | 0:15183cd2c928 | 1 | |
khayakawa | 0:15183cd2c928 | 2 | #include "mbed.h" |
khayakawa | 0:15183cd2c928 | 3 | #include "C12832_lcd.h" |
khayakawa | 0:15183cd2c928 | 4 | |
khayakawa | 0:15183cd2c928 | 5 | Serial pc(USBTX, USBRX); // tx, rx |
khayakawa | 0:15183cd2c928 | 6 | Serial device(p9, p10); // tx, rx |
khayakawa | 0:15183cd2c928 | 7 | C12832_LCD lcd; |
khayakawa | 0:15183cd2c928 | 8 | |
khayakawa | 0:15183cd2c928 | 9 | char* ch[16]={"0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F"}; |
khayakawa | 0:15183cd2c928 | 10 | |
khayakawa | 0:15183cd2c928 | 11 | void dev_rx () { |
khayakawa | 0:15183cd2c928 | 12 | char val; |
khayakawa | 0:15183cd2c928 | 13 | int tmp1,tmp2; |
khayakawa | 0:15183cd2c928 | 14 | |
khayakawa | 0:15183cd2c928 | 15 | val=device.getc(); |
khayakawa | 0:15183cd2c928 | 16 | //lcd.printf("%x ",val); |
khayakawa | 0:15183cd2c928 | 17 | tmp1 = val/16; |
khayakawa | 0:15183cd2c928 | 18 | tmp2 = val%16; |
khayakawa | 0:15183cd2c928 | 19 | pc.printf("%s%s",ch[tmp1],ch[tmp2]); |
khayakawa | 0:15183cd2c928 | 20 | //wait(.2); |
khayakawa | 0:15183cd2c928 | 21 | |
khayakawa | 0:15183cd2c928 | 22 | |
khayakawa | 0:15183cd2c928 | 23 | |
khayakawa | 0:15183cd2c928 | 24 | } |
khayakawa | 0:15183cd2c928 | 25 | |
khayakawa | 0:15183cd2c928 | 26 | int main() { |
khayakawa | 0:15183cd2c928 | 27 | |
khayakawa | 0:15183cd2c928 | 28 | lcd.cls(); |
khayakawa | 0:15183cd2c928 | 29 | lcd.locate(0,0); |
khayakawa | 0:15183cd2c928 | 30 | |
khayakawa | 0:15183cd2c928 | 31 | device.attach(&dev_rx, Serial::RxIrq); |
khayakawa | 0:15183cd2c928 | 32 | |
khayakawa | 0:15183cd2c928 | 33 | |
khayakawa | 0:15183cd2c928 | 34 | |
khayakawa | 0:15183cd2c928 | 35 | } |