Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Multimeter design,

Status
Not open for further replies.

tuanbf

New Member
Hi everybody,
I'm designing a student project, it is a design and implementation of a multimeter. I'm using 80188 CPU, AD2780 AD converter and display the result by 6 7-segment LEDs.

The problem is:
- How to I display the digital output to the 7-segment LEDs in real number format?

Exp I got the 0b 1101 0111 ( = 215D) after AD step. From this result, the input voltage is supposed to be 215\256 * 5(V) = 4.2V.
How do I display 11010111 in 4.2V LEDs format?
Thanks a lot

LED1 LED2 LED3
4 . 2
 
FIrst u have to decide the number of 7-segment LED's.
If u use 3 LED's and want to display the floating pouint numbers, then the maximum value you can show will be 99.9. If your multimeter full-scale is the same, then there is no problem.

But if you want to have more numbers you have to increase the 7-segment LED's.

If floating point is your problem. You will be always using the floating point. So what you can do is to continuously make the DOT POINT, ON. This will remove the floating point overhead from your controller.( Your program will become compact).

I hope i made myself clear.
 
Ya, thanks for your reply but I think you misunderstand my question.
Well, what I actually ask is: how do we code for 80188 such that we input 8-bit binary number, after conversion process, we output real decimal value of it by using 7-segment LEDs?
Thx again =)
 
Are you asking about BCD? It has been awhile since school. Look up binary coded decimal. That might be it.
 
The correct input voltage is V = x / 255 * 5.
Your error is very common, and I found it in books and tutorials.
With 8 bit you can code decimal numbers from 0 (=0b00000000) to
255 (=0b11111111).
This equation is even better: V = x * 5 / 255.
Your equation may be useful to avoid floating-point calculations (add
x five times and left shift all the bits by 8 positions) but I prefer to
avoid other errors in the measurement, besides noise,
tolerances and so on.

Supposing that the input voltage is 4.2 V, just consider the integer
number 42. You must store each digit in an unsigned integer variable.
Each display must be turned on at one time, displaying each digit.
Your eyes will see all the digits displayed, if that operation is done
with a certain frequency. The displays are "multiplexed". If you can't
imagine this tecnhique working, look at this nice picture:
www.eeng.biz/multiplex.htm
In order to display digits on the display you must know the pin lay-out
and what type they are (common cathode or anode). Each pin turn on/off one
LED of the display. If you want to show number '8' all the LEDs, except the
dot point, must be turned on, and so on...
 
The short answer is that you divide by successive powers of 10. Using integer arithmetic:

[0..255]/100 gives a quotient Q1 and a remainder R1
R1/10 gives you another quotient Q2 and a remainder R2

Your result in decimal is just Q1 Q2 R2

If you want to scale the original number [0..255] then you can multiply and divide before you convert. Example if [0..255] maps to [0..1000] you would multiply by 1000 and divide by 255. Then convert the resulting number.

For 256 values I like creating a table in Excel and outputting the file as a text file with spaces as delimiters. If you do it right Excel will generate a file you can feed right into your compiler or assembler.
 
eng1 said:
The correct input voltage is V = x / 255 * 5.
Your error is very common, and I found it in books and tutorials.
With 8 bit you can code decimal numbers from 0 (=0b00000000) to
255 (=0b11111111).
This equation is even better: V = x * 5 / 255.
Your equation may be useful to avoid floating-point calculations (add
x five times and left shift all the bits by 8 positions) but I prefer to
avoid other errors in the measurement, besides noise,
tolerances and so on.

Firstly, left shifting is multiply, not divide. Secondly, shifting eight position is x256 or divide by 256, not 255 as needed in the above equation.
 
I correct my previous message... you must right shift the bits in order to divide, of course.
Shifting 8 positions, you divide by 256 and not by 255, of course. If you can accept this error you avoid floating point calculations and speed up you circuit. It depends on the accuracy that your application must have.
I remark again that the correct equation is V = x / 255 * 5 or
V = x / (2^m - 1) * 5 if m is the resolution of your A/D converter.
 
What programming language are you using?

If it's assembler you can just use the divide instruction, it gives you bothe the quotant and remainder.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top