![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
ddad
Dependencies: mbed
Fork of class_7segment_serial by
Diff: SegDisplay.cpp
- Revision:
- 2:120a14d6f055
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/SegDisplay.cpp Tue Jun 06 10:00:51 2017 +0000 @@ -0,0 +1,24 @@ +#include "SegDisp.h" + + +char SegConvert(char SegValue) { // function 'SegConvert' +char SegByte=0x00; +switch (SegValue) { //DPGFEDCBA +case 0 : SegByte = 0x3F;break; // 00111111 binary +case 1 : SegByte = 0x06;break; // 00000110 binary +case 2 : SegByte = 0x5B;break; // 01011011 binary +case 3 : SegByte = 0x4F;break; // 01001111 binary +case 4 : SegByte = 0x66;break; // 01100110 binary +case 5 : SegByte = 0x6D;break; // 01101101 binary +case 6 : SegByte = 0x7D;break; // 01111101 binary +case 7 : SegByte = 0x07;break; // 00000111 binary +case 8 : SegByte = 0x7F;break; // 01111111 binary +case 9 : SegByte = 0x6F;break; // 01101111 binary + } + return SegByte; +} + +void SegInit(void) { +Seg1=SegConvert(0); // initialise to zero +Seg2=SegConvert(0); // initialise to zero +}