Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[SOLVED] 7 Segment 5 Digit Driver

Status
Not open for further replies.
I use mikroC PRO PIC Compiler. Here is the project file for blinking display. Use my .hex file to test the simulation. The code is small and hence you can download and use the demo version of the compiler if needed.
 

Attachments

  • SSD Blinking code ver4.rar
    29.5 KB · Views: 84

Code:
if( up_push){
        	_delay_cycles(50-1);
        	while(up_push);


        	if(++up == 10)up = 0;
        	
        	switch(setCounter){
        	case 0:
        		display[0]=display[0];
        		display[1]=display[1];
        		display[2]=display[2];
        		display[3]=display[3];
        		display[4]=display[4];
        	case 1:
        		display[4]=capture[up];
        		break;
        	case 2:
        		display[3]=capture[up];
        		break;
        	case 3:
        		display[2]=capture[up];
        		break;
        	case 4:
        		display[1]=capture[up];
        		break;
        	case 5:
        		display[0]=capture[up];
        		break;
        	default: break;
        	}

I want to add "up" and "down" buttons into your code. When the up button pressed while setCounter = 1, code should be increased the first digit value which is defined as display[4]. Inversely, when "down" button is pressed, the value of the digit should be decreased. This shoud proceed for each digit.

The above code is not correct at all, all digits show the same value of "up" variable :(

Thanks in advance
 

Try the attached project.
 

Attachments

  • SSD Blinking code ver5.rar
    31.4 KB · Views: 76
  • Like
Reactions: actor23

    actor23

    Points: 2
    Helpful Answer Positive Rating
pic.programmer ;

Thank you for all your help. Now it is time to display letters on the screen. Do you think that i should update the mask array with writeable letters or do you have any smarter idea for example coded each letter or digit into ascii table or something like that ?
 

There was a bug. Had to cast the result to unsigned long. I have fixed it. Yes, you have to create different masks (mask arrays) for displaying different alphabetical messages and in ISR you have to use a counter which decides which message is displayed.
 

Attachments

  • SSD Blinking code ver6.rar
    41.9 KB · Views: 76

Try this project. Press the RB3 button and the display will cycle between normal display and messages.
 

Attachments

  • SSD Blinking code ver7.rar
    34.2 KB · Views: 89
  • ssd.png
    ssd.png
    87.7 KB · Views: 99
  • Like
Reactions: actor23

    actor23

    Points: 2
    Helpful Answer Positive Rating
Jayanth ;

Thanks for all your efforts. Actually, different arrays and if condition in the ISR is good idea to display whether digits or letters. But, i am trying to make more compact algorithm. For example :

There is one table which consist of {1,2,3,4,.......,A,b,C,F.......-,.} digits,letters and "-" sign also "." sign to show the dotted represantation. Also, there should be a coded another table which should be ASCII table and hex number of each char, like m = 041 a=011 etc. these values may be wrong it is just example.

There are one variable called display like your number variable. It should be everything for instance -12.98 it can be displayed by 5 digit. If we assign some values to variable, it should be convert ascii numbers first then every triple should process to send "sendDisplay" function then it can be seen on screen. The variable type can be any (int,char,long,float..) signed or unsigned, letters etc. (12345, -12345, -12.67,Error,...)
 

That can be easily done. I will show you an example tomorrow. It will have one array called mask which will have mask for digits, alphabets and the array is used to get mask values and assign it to display[] array once when ever the data changes and the value in display array is sent to 7 Segment port.
 

There should be ascii table to do this work generally. Which functions do you plan to use like "atoi" and "itoa" for convergence ?
 

Here to chr to ascii conversion example after that there must be another function definitions that converts chars to integers, floats,etc. to increase or decrease its values by pressing the buttons.

sprintf.png

- - - Updated - - -

Also, there is limited letters or digits can be displayed on 7 segment, so that display[] contains a few data. I could not convert char values into integers to change their values. It will be more compact when it is done.
 

Did you fix the ghosting of the previous digit?

YOu can improve the contrast ratio of the LEDs with a red plastic filter over the display to match the colour in order to block reflected ambient light.
 

@SunnySkyGuy , yes, i've solved the ghosting problem. It was because of code error. But, there is new concern i do not really understand the current value that flows in my circuit. It is 7mA or 8mA while blinking. Is it too low for 5 digit ? It is DC current but, if each digit's standart working current is 15mA should it been 75mA DC ?

I've used CD4017BE, TPIC5b695, 2N3904(npn bjts) also 100 ohm for each digit on emmitter to led. Display brightness can be seen while sunny even draw 8mA from the source ?

Thanks in advance.
 

If the display is bright enough, you won't worry about segment current. isn't it?

Average and peak segment current are separate datasheet parameters. You should check the specification of your display. Factor 4 or 5 between average and peak current is often permitted in datasheets.
 

@SunnySkyGuy , yes, i've solved the ghosting problem. It was because of code error. But, there is new concern i do not really understand the current value that flows in my circuit. It is 7mA or 8mA while blinking. Is it too low for 5 digit ? It is DC current but, if each digit's standart working current is 15mA should it been 75mA DC ?

I've used CD4017BE, TPIC5b695, 2N3904(npn bjts) also 100 ohm for each digit on emmitter to led. Display brightness can be seen while sunny even draw 8mA from the source ?

Thanks in advance.

I explained you need 5x the average current for maximum brightness of 20 per segment.
You may not need 100mA per segment and this requires 700mA for each digit if all segments are on.
Thus you can choose Rs for each segment driver from 22 to 100 Ohm. for 20mA to 6mA Average

Digit driver must be LOW driver impedance to avoid dimming digit when 7 segments ON vs 2 segments.

Thus a 1A transformer is needed due to efficiency.

But your present driver (wil get hot) and probably won't allow much more than 150mA per digit with a hFE gain of 100 and a drop of 2V to Anode from 5V.
If you segments are rated less in specs.. adjust accordingly.

My design is for maximum brightness with a RED FILTER to block stray ambient light and improve quality of display contrast, uses 2 inverting Q drivers.
My output stage will dissipate 1/4W max, so choose transistor wisely or the one I recommended.

See my entry in post #50
 
Last edited:
  • Like
Reactions: actor23

    actor23

    Points: 2
    Helpful Answer Positive Rating
@pic.programmer ;

please study this code and tell me what is the cause of digit ghosting :( If i try for -12.34 the one or two segment of digit which is with "dot point" are ghosting. Furthermore, if i write 123 to number it is displayed as "12300"

Is it because many conditional operator that i used in the ISR ?

Also, capture[128] is ascii table conversion array which is meaningful for sendByte function. If you try it in proteus,please invert the values on capture array ( 0xFF with 0x00, and values with inverting forms)

Thanks in advance
 

Attachments

  • main.txt
    11.7 KB · Views: 76

Your post sounds confused. Didn't you report in post #72 that the ghosting problem had been solved?
 

Yes, it was solved in the example of previous code which had not ascii table. This is new version code which includes ascii table conversion and more statement im the İSR.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top