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.

I need your help and a question related to 89C51

Status
Not open for further replies.

semiconductor

Full Member level 4
Joined
Apr 4, 2003
Messages
236
Helped
4
Reputation
8
Reaction score
0
Trophy points
1,296
Activity points
2,735
I’m trying to display the voltage using 7-segment LED
My input voltage is: 0  25 Volts

This is my idea:

Components involved in this kit are: AD0804 (ADC); uC AT89C51; CD4511B (BCD-to-7seg decoder) and Common-Cathode 7-segment LED

First of all, I apply the input voltage to a divider to fit the input voltage range of the ADC AD0804 (5V). To do this, I extract 5V from 25V by using divider 1:5

Then, the output of this AD0804 (8 bits) is applied to port 0 of AT89C51. I use my software to transform from 8bits to 3 BCD-numbers. This 3 BCD-numbers are then fed to 3 CD4511Bs to decode and display on the LED. (each level of the ADC equals to 0.1 Volt)

Is the above idea is ok?
How can I transform from 8 bits to 3 BCD numbers?
How can I decode the BCD to 7 seg LED using CD4511B (how to connect the pins LE, LT, BI)?

By the way, I would like to ask you a simple question

This program must the to set the pin P0.0 to 0V and P0.1 to 5V but when I use the volt-meter, it is not as expected (pin P0.0 is 0V but P0.1 is 2.0  2.5V). I can not explain why, can you help me!

Code:
Org 0000
Loop:
    Setb P0.1
    Clr P0.0
    Sjmp Loop
End

If you have done something similar, if you can, please share your experience and documents.

Thank you in advance!
 

Well, the p0.1 problem is easy to solve...

P0 on the 89C51 requires pull-up resistors to 5V. The ouputs on this port are open-drain, so that they will pull to 0V but if set to ouput high, the output floats (high impedance). Just add resistors, about 10K is fine, connecting the required port pins to +5V.

Note that the other ports have these resistors inside the chip, that's why you only need them on port 0.

As to the 4511 pins...

LT is 'Lamp Test' - it just lights all the segments if low. Tie it to +5V with a 10K resistor for normal operation.

BL is 'Blanking' - it blanks (turns off) all segments if low. Tie it to +5V for normal operation as above. This can also be used to control the brightness by PWM.

Note that the above do not change the stored character in the 4511's latch.

LE/Strobe is to latch the data (LE is 'Latch Enable'). If kept low, whatever character is given on the 4 inputs will be displayed. If taken high, the latch will keep the last given character on the display and ignore any changes to its input until LE is taken low again.

You could use the LE pins to put the data into the 4511's - just use 4 port lines for the BCD, and put each character into the appropriate 4511 by setting its LE low, then high to latch it. Do the same for the next 4511, etc. This way, you use just 4 port lines for the BCD and 3 lines for the LE of each 4511.

Finally, converting 8 bits to 3xBCD. There are a few ways to do this, some fast, some slow. Here is a simple one, in psedo-code...

(assume starting 8-bit number is in A)
MOV B, 100
DIV A, B
(A now contains the 100's digit, store it somewhere before doing the next operation. B has the remainder)
MOV A, B
MOV B, 10
DIV A, B
(A now contains the 10's digit, store it somewhere. B has the remainder - the 1's digit)

With the above code (off the top of my head, hope it works!) The BCD numbers come out as full bytes (4-msb's will be 0, 4-lsb's are BCD)

Cheers,
FoxyRick.
 

Try to use Serial ADC, it is better, parallel ADC requires more pins and also you need to monitor the interrupt ping of the ADC.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top