ddad
Dependencies: mbed
Fork of class_7segment_serial by
SegDisplay.cpp@2:120a14d6f055, 2017-06-06 (annotated)
- Committer:
- mijimy
- Date:
- Tue Jun 06 10:00:51 2017 +0000
- Revision:
- 2:120a14d6f055
sdsfsgdf
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mijimy | 2:120a14d6f055 | 1 | #include "SegDisp.h" |
mijimy | 2:120a14d6f055 | 2 | |
mijimy | 2:120a14d6f055 | 3 | |
mijimy | 2:120a14d6f055 | 4 | char SegConvert(char SegValue) { // function 'SegConvert' |
mijimy | 2:120a14d6f055 | 5 | char SegByte=0x00; |
mijimy | 2:120a14d6f055 | 6 | switch (SegValue) { //DPGFEDCBA |
mijimy | 2:120a14d6f055 | 7 | case 0 : SegByte = 0x3F;break; // 00111111 binary |
mijimy | 2:120a14d6f055 | 8 | case 1 : SegByte = 0x06;break; // 00000110 binary |
mijimy | 2:120a14d6f055 | 9 | case 2 : SegByte = 0x5B;break; // 01011011 binary |
mijimy | 2:120a14d6f055 | 10 | case 3 : SegByte = 0x4F;break; // 01001111 binary |
mijimy | 2:120a14d6f055 | 11 | case 4 : SegByte = 0x66;break; // 01100110 binary |
mijimy | 2:120a14d6f055 | 12 | case 5 : SegByte = 0x6D;break; // 01101101 binary |
mijimy | 2:120a14d6f055 | 13 | case 6 : SegByte = 0x7D;break; // 01111101 binary |
mijimy | 2:120a14d6f055 | 14 | case 7 : SegByte = 0x07;break; // 00000111 binary |
mijimy | 2:120a14d6f055 | 15 | case 8 : SegByte = 0x7F;break; // 01111111 binary |
mijimy | 2:120a14d6f055 | 16 | case 9 : SegByte = 0x6F;break; // 01101111 binary |
mijimy | 2:120a14d6f055 | 17 | } |
mijimy | 2:120a14d6f055 | 18 | return SegByte; |
mijimy | 2:120a14d6f055 | 19 | } |
mijimy | 2:120a14d6f055 | 20 | |
mijimy | 2:120a14d6f055 | 21 | void SegInit(void) { |
mijimy | 2:120a14d6f055 | 22 | Seg1=SegConvert(0); // initialise to zero |
mijimy | 2:120a14d6f055 | 23 | Seg2=SegConvert(0); // initialise to zero |
mijimy | 2:120a14d6f055 | 24 | } |