How to display calculating real number on 7segment display!

Status
Not open for further replies.

milem

Newbie level 6
Joined
Mar 11, 2008
Messages
14
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,382
I need to display numbers from formula:

result=sel*value1/value2;
sel have values (1,10,100,1000)
value1 and value2 are unsigned integers
On four 7 segment display i need to show first 3 number with decimal dot!

I need calculation without using float or double values!

I make some code but he is using almost 1000bytes.

I need some code in keil c with less memory usage!
 

Re: How to display calculating real number on 7segment displ

Hello!

A similar question has already been treated recently. Note that I said similar,
not exactly the same. Now, what did you already write, and where did you
get stuck? I mean, you don't expect other user to do all your work, do you?

Dora.
 

Yes i know! I first search all posta i can find, not only here! But replays don't suit me!

In short i write:
switch(sel){
case 1:case 10:case 100:
a=(sel*value1)/value2;
b=(sel*value1)%value2;
break;
case 1000:
a=(value1)/value2;
b=(value1)%value2;
break;

and then lot of if then else
to put numbers in correct place on display
i looking maybe some one have another idea
how to make this!
 

Re: How to display calculating real number on 7segment displ

For all who hve similar problem i found solution!

Code:
typedef unsigned int uint;
typedef unsigned char ubyte;
uint tm,to;

void divide(uint a, uint b)
{
uint x=0;
ubyte i;

tm=a/b;
x=a%b;
	for(i=4;i>=1;i--)
	{
		if(x<b) x=x*10;
		to=to+x/b;
		x=x%b;
		if(i>1) to<<=4;
	}
}
void main(void)
{
divide(0x120,0x200);
return;


}

tm have main number
to have number after
after that showing od 7 segment display is easy!
i will put code i you need!
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…