Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: kitchenTimer_Clock kitchenTimer LPC1114FN28_kitchenTimer_Clock SevenSegmentLedSample ... more
Revision 1:3429249e30f9, committed 2011-12-02
- Comitter:
- suupen
- Date:
- Fri Dec 02 13:53:34 2011 +0000
- Parent:
- 0:5410d6e2bce7
- Child:
- 2:cca0fd8ccb97
- Commit message:
- V2.0 2011/12/02 seven segment 8digit display
Changed in this revision
| SevenSegLed.cpp | Show annotated file Show diff for this revision Revisions of this file |
| SevenSegLed.h | Show annotated file Show diff for this revision Revisions of this file |
--- a/SevenSegLed.cpp Sun Nov 20 00:22:05 2011 +0000
+++ b/SevenSegLed.cpp Fri Dec 02 13:53:34 2011 +0000
@@ -15,9 +15,10 @@
/** Create a seven segment led object connected to the specified DigtalOutput pin
*/
-SevenSegLed::SevenSegLed(uint8_t commonPole, uint8_t smooth, PinName seg_a, PinName seg_b, PinName seg_c, PinName seg_d, PinName seg_e, PinName seg_f, PinName seg_g, PinName seg_p, PinName com_1, PinName com_2, PinName com_3, PinName com_4):
+SevenSegLed::SevenSegLed(uint8_t commonPole, uint8_t smooth, PinName seg_a, PinName seg_b, PinName seg_c, PinName seg_d, PinName seg_e, PinName seg_f, PinName seg_g, PinName seg_p,
+ PinName com_1, PinName com_2, PinName com_3, PinName com_4, PinName com_5, PinName com_6, PinName com_7, PinName com_8):
_seg_a(seg_a), _seg_b(seg_b), _seg_c(seg_c), _seg_d(seg_d), _seg_e(seg_e), _seg_f(seg_f), _seg_g(seg_g), _seg_p(seg_p),
- _com_1(com_1), _com_2(com_2), _com_3(com_3), _com_4(com_4){
+ _com_1(com_1), _com_2(com_2), _com_3(com_3), _com_4(com_4), _com_5(com_5), _com_6(com_6), _com_7(com_7), _com_8(com_8){
timer.attach_us(this, &SevenSegLed::segmentGrayDataKosin, 10000); // led smooth control 10ms timer inttruupt
@@ -30,6 +31,10 @@
// check connect com_x
D_comNull = Z_ketaSuu;
+ if(com_8 == NC){D_comNull--;}
+ if(com_7 == NC){D_comNull--;}
+ if(com_6 == NC){D_comNull--;}
+ if(com_5 == NC){D_comNull--;}
if(com_4 == NC){D_comNull--;}
if(com_3 == NC){D_comNull--;}
if(com_2 == NC){D_comNull--;}
@@ -165,9 +170,21 @@
void SevenSegLed::comAllClear(void){
switch (D_comNull){
- case 4: // com_1 - com_4 is all connect
+ case 8: // com_1 - com_8is all connect
+ _com_8 = D_commonOff;
+ //break;
+ case 7: // com_8 Null
+ _com_7 = D_commonOff;
+ //break;
+ case 6: // com_7 Null
+ _com_6 = D_commonOff;
+ //break;
+ case 5: // com_6 Null
+ _com_5 = D_commonOff;
+ //break;
+ case 4: // com_5 Null
_com_4 = D_commonOff;
- //break;
+ //break;
case 3: // com_4 Null
_com_3 = D_commonOff;
// break;
@@ -253,7 +270,19 @@
break;
case 3:
_com_4 = D_commonOn;
- break;
+ break;
+ case 4:
+ _com_5 = D_commonOn;
+ break;
+ case 5:
+ _com_6 = D_commonOn;
+ break;
+ case 6:
+ _com_7 = D_commonOn;
+ break;
+ case 7:
+ _com_8 = D_commonOn;
+ break;
default:
break;
}
--- a/SevenSegLed.h Sun Nov 20 00:22:05 2011 +0000
+++ b/SevenSegLed.h Fri Dec 02 13:53:34 2011 +0000
@@ -21,11 +21,13 @@
*/
-/***********************************************************************/
-/* */
-/* ledDynamic.h */
-/* */
-/***********************************************************************/
+//***********************************************************************/
+//* */
+//* ledDynamic.h */
+//* V1.0 : 4digit(4com) display */
+//* V2.0 : 8digit(8com) display */
+//* */
+//***********************************************************************/
#ifndef _SEVENSEGLED_H
#define _SEVENSEGLED_H
@@ -36,7 +38,7 @@
* //-----------------------------------------------------------------------------
* //sevenSegmentLed Library Example
* //
- * //This program by one every second counts, do a 4-digit seven-segment LED display.
+ * //This program by one every second counts, do a 8-digit seven-segment LED display.
* //
* //seven segment numeric LED Display : LTC4627P
* // http://www.excesssolutions.com/mas_assets/acrobat/ES5721.pdf
@@ -68,7 +70,7 @@
* // |
* // | display mode (0:smooth 1:hard)
* // | |
- * // | | segA segB segC segD segE segF segG segP com1 com2 com3 com4
+ * // | | segA segB segC segD segE segF segG segP com1 com2 com3 com4 (com5,com6,com7,com8 = NC)
* // | | | | | | | | | | | | | |
* SevenSegLed segmentled(0, 0, p14, p20, p17, p22, p24, p16, p19, p30, p29, p13, p25, p27);
*
@@ -132,7 +134,9 @@
* @param seg_a - seg_p DigitalOut pin to connect to. To provide members with an array of uint8_t digit minutes. 4 digits maximum
* @param com_1 - com_4 DigitalOut pin to connect to. To provide members with an array of uint8_t digit minutes. 4 digits maximum
*/
- SevenSegLed(uint8_t commonPole, uint8_t smooth, PinName seg_a, PinName seg_b, PinName seg_c, PinName seg_d, PinName seg_e, PinName seg_f, PinName seg_g, PinName seg_p, PinName com_1 = NC, PinName com_2 = NC, PinName com_3 = NC, PinName com_4 = NC);
+ SevenSegLed(uint8_t commonPole, uint8_t smooth, PinName seg_a, PinName seg_b, PinName seg_c, PinName seg_d, PinName seg_e, PinName seg_f, PinName seg_g, PinName seg_p,
+ PinName com_1 = NC, PinName com_2 = NC, PinName com_3 = NC, PinName com_4 = NC,
+ PinName com_5 = NC, PinName com_6 = NC, PinName com_7 = NC, PinName com_8 = NC);
/** Data set to the seven segment LED display
* @param number Array variable address pointer of Numerical data 0 - 9,A - F : The figures show, 0x10:off
@@ -149,11 +153,11 @@
// pin set_seg, _com;
DigitalOut _seg_a, _seg_b, _seg_c, _seg_d, _seg_e, _seg_f, _seg_g, _seg_p;
- DigitalOut _com_1, _com_2, _com_3, _com_4;
+ DigitalOut _com_1, _com_2, _com_3, _com_4, _com_5, _com_6, _com_7, _com_8;
Ticker timer;
-#define Z_ketaSuu (4) // 7segment no keta suu
+#define Z_ketaSuu (8) // 7segment no keta suu
#define Z_segSuu (8) // 7segmetn no segment suu (a,b,...,g,Dp)
#define Z_grayMax (100) // grayData max 100 kaicho
#define Z_pwmGrayMax (100) // pwm max (led heno pwm syuturyoku no max)