| ??? 01/28/03 16:42 Read: times |
#37518 - RE: easy way of driving a 7-Segment Display |
You could use the MM5450 serial LED driver..
I have some old ugly but working code that you can have...I don't use them anymore due to graphic lcd displays .. the LED_MAP data only fits the board I made ,you will have to map it to the way wou wire your's,but it not too difficult to do.. // for numbers 0-9 , I added text as define's.. code unsigned char LED_MAP[10] = {0xfc,0x60,0xda,0xf2,0x66,0xb6,0x3e,0xe0,0xfe,0xe6}; unsigned char display_segs(unsigned char c) { unsigned char digit; if((c>9)||(c<0)) digit=0; else digit=LED_MAP[c];//-'0' return(digit); } void clock_x3(void){ unsigned char i; for(i=0; i<4; ++i) { MM5450_CLK =1; delay_short(); MM5450_CLK =0; delay_short(); } } void mm5450_init(void){ MM5450_DOUT=0; delay_short(); MM5450_DOUT=1; MM5450_CLK=1; delay_short(); MM5450_CLK=0; MM5450_DOUT=0; delay_short(); } void mm5450_reset(void){ MM5450_ENABLE=1; } void load_digits(unsigned int Led_Data) { unsigned char i; delay_short(); for(i=0; i<8; ++i) { if((Led_Data & 1)==0) MM5450_DOUT=0; else MM5450_DOUT=1; MM5450_CLK=1; delay_short(); MM5450_CLK=0; Led_Data=Led_Data>>1; } } void display_text(unsigned char one,unsigned char two,unsigned char three,unsigned char four){ delay_short(); mm5450_init(); load_digits(one); load_digits(two); load_digits(three); load_digits(four); clock_x3(); mm5450_reset(); } void display_data_8( unsigned char value) { unsigned char temp3,temp4,temp5,segs; temp3=value%10; value/=10; temp4=value%10; value /=10; temp5=value%10; mm5450_init(); segs=display_segs(temp5); load_digits(segs); segs=display_segs(temp4); load_digits(segs); segs=display_segs(temp3); load_digits(segs); load_digits(0); clock_x3(); mm5450_reset(); } |
| Topic | Author | Date |
| easy way of driving a 7-Segment Display | 01/01/70 00:00 | |
| RE: easy way of driving a 7-Segment Display | 01/01/70 00:00 | |
| RE: easy way of driving a 7-Segment Disp | 01/01/70 00:00 | |
| RE: easy way of driving a 7-Segment Display | 01/01/70 00:00 | |
| RE: Steve | 01/01/70 00:00 | |
| Rob\'s cuestion | 01/01/70 00:00 | |
| RE: Rob\'s cuestion | 01/01/70 00:00 | |
| RE: easy way of driving a 7-Segment Display | 01/01/70 00:00 | |
| RE: easy way of driving a 7-Segment Display | 01/01/70 00:00 | |
| RE: easy way of driving a 7-Segment Display | 01/01/70 00:00 | |
RE: easy way of driving a 7-Segment Display | 01/01/70 00:00 |



