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.

5 digits 7segment display

Status
Not open for further replies.

johnny78

Full Member level 3
Joined
Jun 28, 2017
Messages
166
Helped
0
Reputation
0
Reaction score
3
Trophy points
18
Activity points
1,200
hi Guys
i need to display my scale weight on 5 digits 7 segment display
i've used Dean reading Arduino library for this & it works for 5 digits
how to display numbers with decimal point?

ive tried to declare the variable as float but it didnt work
Code:
float test = 99.5;
this shows number 100 on the display
i have read about the data types But i couldnt understand why it shows 100

what do u suggest ?

here is the Library i use

thanks
Johnny
 
Last edited:

KlausST

Super Moderator
Staff member
Joined
Apr 17, 2014
Messages
23,018
Helped
4,715
Reputation
9,446
Reaction score
5,087
Trophy points
1,393
Activity points
152,504
Hi,

Fixed?
Or variable? In which range?

I usually try to use fixed decimals.
So if 2 decimals, then the range is 0.00 to 999.99.
I treat it as an integer with range of 0 to 99999.
So basically this means a range of 1:100000 , which is more than a 16 bit variable can handle.

So it's not only the decimals range we need to know, but also the resolution ..
and if the value is signed .. and how to treat it.

Klaus
 

paulfjujo

Advanced Member level 4
Joined
Jun 9, 2008
Messages
1,459
Helped
296
Reputation
592
Reaction score
279
Trophy points
1,363
Location
France 01800
Activity points
10,409
hi Guys
i need to display my scale weight on 5 digits 7 segment display
i've used Dean reading Arduino library for this & it works for 5 digits
how to display numbers with decimal point?

ive tried to declare the variable as float but it didnt work
Code:
float test = 99.5;
this shows number 100 on the display
i have read about the data types But i couldnt understand why it shows 100

what do u suggest ?

here is the Library i use

thanks
Johnny
How do you send this value to 7 segm..

Code:
test=99.5;
sevseg.setNumberF(test,1);
 

    johnny78

    Points: 2
    Helpful Answer Positive Rating

johnny78

Full Member level 3
Joined
Jun 28, 2017
Messages
166
Helped
0
Reputation
0
Reaction score
3
Trophy points
18
Activity points
1,200
How do you send this value to 7 segm..

Code:
test=99.5;
sevseg.setNumberF(test,1);
hi Mr

i use sevseg.setNumber(test);
why you use F & (test,1);?

thanks
--- Updated ---

Hi,

Fixed?
Or variable? In which range?

I usually try to use fixed decimals.
So if 2 decimals, then the range is 0.00 to 999.99.
I treat it as an integer with range of 0 to 99999.
So basically this means a range of 1:100000 , which is more than a 16 bit variable can handle.

So it's not only the decimals range we need to know, but also the resolution ..
and if the value is signed .. and how to treat it.

Klaus
Hi
its variable value i get from an electronic scale
yes the reange is 0.00 to 999.99.

what do you mean by resolution ?
signed you mean like negative value with -?
yes sometimes it is & i should add another segment to display this

thanks
Johnny
 
Last edited:

KlausST

Super Moderator
Staff member
Joined
Apr 17, 2014
Messages
23,018
Helped
4,715
Reputation
9,446
Reaction score
5,087
Trophy points
1,393
Activity points
152,504
Hi,
why you use F & (test,1);?
The documentation tells me the "..F" is for float numbers. And 99.5 is a float number. No integer.
****

0.00 to 999.99: so it´s fixed two decimals.
How do you want to treat negative numbers, because obviously -999.99 is not possible.

resolution:
with a 5 digit you may show positive values 0.0000 ... 0.0001 (or even .00001) .... 99999
so the resolution could theoretically be .00001 (10 micro) and dynamically adjust the number of decimals.

Klaus
 

    johnny78

    Points: 2
    Helpful Answer Positive Rating

johnny78

Full Member level 3
Joined
Jun 28, 2017
Messages
166
Helped
0
Reputation
0
Reaction score
3
Trophy points
18
Activity points
1,200
Hi,

The documentation tells me the "..F" is for float numbers. And 99.5 is a float number. No integer.
****
which documentation ? like Arduino reference ?
why using the 1 after the varible ?

sevseg.setNumberF(test,1);

anyway i have tried this method but it gives me error when compiling
'class sevseg' has no member named 'setNumberF'.
0.00 to 999.99: so it´s fixed two decimals.
How do you want to treat negative numbers, because obviously -999.99 is not possible.
i may get 000.00 to 999.99 but sometime when u carry out the load of the scale it may give negative value
because of the mechanical springs .
its small vallue like -001.00 lets say so its not important much but im interested to know how can i solve this issue
resolution:
with a 5 digit you may show positive values 0.0000 ... 0.0001 (or even .00001) .... 99999
so the resolution could theoretically be .00001 (10 micro) and dynamically adjust the number of decimals.
thanks for the direct answer
you help is very Appreciated
Johnny
 
Last edited:

KlausST

Super Moderator
Staff member
Joined
Apr 17, 2014
Messages
23,018
Helped
4,715
Reputation
9,446
Reaction score
5,087
Trophy points
1,393
Activity points
152,504
Hi
which documentation ? like Arduino reference ?
In post#1 you posted a link to the GitHub library with it´s readme.md. Just scroll down a bit.
It tells you the difference between setNumber and setNumberF and how to use them.

Negative values:
You are free to differentiate between negative and positve values.
So you are free to use 000.00 to 999.99 as positive values
and -00.00 to -99.99 as negative values (mind the most left digit is used as "minus" sign, leaving just 4 (out of 5) digits to show values.

Klaus
 

johnny78

Full Member level 3
Joined
Jun 28, 2017
Messages
166
Helped
0
Reputation
0
Reaction score
3
Trophy points
18
Activity points
1,200
Hi

In post#1 you posted a link to the GitHub library with it´s readme.md. Just scroll down a bit.
It tells you the difference between setNumber and setNumberF and how to use them.
i have tried to read this file but i couldnt find an app to open md file
will google it
Negative values:
You are free to differentiate between negative and positve values.
So you are free to use 000.00 to 999.99 as positive values
and -00.00 to -99.99 as negative values (mind the most left digit is used as "minus" sign, leaving just 4 (out of 5) digits to show values.
i will another segment to show the minus sign i was planning for it

thanks
Johnny
 

johnny78

Full Member level 3
Joined
Jun 28, 2017
Messages
166
Helped
0
Reputation
0
Reaction score
3
Trophy points
18
Activity points
1,200
Hi

???
No need for an app. The text already shown.
As said: just scroll down.

Klaus
Hi

i've tried to read it from the downloaded file first
then i opened it in the github
it was the same method but the version i was using is older & seems like it does'nt support this feature

i have used:
(float test=987.5)
(sevseg.setNumberF(test))But i didnt get a decimal point

then used this
(sevseg.setNumberF(test, 1);& the decimal point is here finally
what is the 1 added after the test variable? that was mentioned by Paulfjuju?

thanks
Johnny
 

KlausST

Super Moderator
Staff member
Joined
Apr 17, 2014
Messages
23,018
Helped
4,715
Reputation
9,446
Reaction score
5,087
Trophy points
1,393
Activity points
152,504
Hi,

What are yo doing?
No need to open a file. Click on your link in post#1 (github) and then, again: just scroll down.

The functions and their parameters are explained there.
(Do we see a different internet page than you ???)
In either case it should be possible to do a browser search for "setNumberF" on the github page.

Klaus
 

    johnny78

    Points: 2
    Helpful Answer Positive Rating

johnny78

Full Member level 3
Joined
Jun 28, 2017
Messages
166
Helped
0
Reputation
0
Reaction score
3
Trophy points
18
Activity points
1,200
Hi

i've tried to read it from the downloaded file first
then i opened it in the github
it was the same method but the version i was using is older & seems like it does'nt support this feature

i have used:
(float test=987.5)
(sevseg.setNumberF(test))But i didnt get a decimal point

then used this
(sevseg.setNumberF(test, 1);& the decimal point is here finally
what is the 1 added after the test variable? that was mentioned by Paulfjuju?

thanks
Johnny
Hi

Got it finally

Floats are supported. In this case, the second argument indicates how many decimal places of precision you want to display.

its all done i guess

thank you
Johnny
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top