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.

three 7-segment displays

Status
Not open for further replies.

Mr.sony

Newbie level 3
Joined
Mar 24, 2006
Messages
3
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,309
Hello
i have a 8-bit number that i need to show on three 7-segment displays, i don’t know how to do it , how can i convert the number (0-255) into digits ( hundreds, tens, ones) to be displayed on each of the 7-segment.
If some one knows how to do it plz help me .

many thanks
 

well the solution to your problem can be found in

Digital Design: Principles and Practices 3/E

Author: John F. Wakerly
Stanford University
ISBN: 0-13-176059-9
Copyright: 2003
 

Mathematic it's easy:
Take the 8-bit number and divide it by 100.
Display the quotient according to what is called lookup table (where is stored the status of each of display segment a-g according to your physical port))
Take the reminder of the previous operation and divide it by 10.
Display the quotient as above.
Take the reminder of the previous operation and display it as above.

For harware you can choose to fit your 3 7-digits displays to different ports of a microcontroller or to use only one 8-bit port and 3-bits from the other for controlling the multiplexer.
It will be much easier to explain if you can mentione for which microcontroller you want that and what programming language you preffer. You must mentione if the 7segments display have common cathode or anode for appropiate circuit diagram.
like this one:
ledfig6.gif
 

i am using pic18f252 , and i am programming using assembly, can you tell me how can i t divide a number in assembly .

Many thanks
 

Read Appendix C: "MPLXCH0.ASM" of this document where A/D conversion result is converted from an 8-bit binary value (0 - 255) to a 3-digit Binary Code Decimal (BCD) value, which is then displayed on the 7-segment LEDs.
 

many thanks for the help, but i still have a problem , i don’t know why the PCL doesn’t jump to the right line, when i should go to line 8 it goes to line 4 ???
do you have any idea why is that happening
 

Before LedTable is called, the working register W is loaded with a value wich is added to PCL inside LedTable subroutine.
When you return from CALL, the W register contains the appropiate binary value that should be diplayed on PORTB.
If you're expecting to display 8 but you got an 4, check the value of W before LedTable is called.
As you probably notice before calling LedTable two steps are performed more.
It's ckecked if the previous high digit has a value different of zero. if Yes, a 0 is displayed. If not, the digit is blanked (W=B'00000000')
Second step, the W register has his high nibble cleared, just to be sure you don't go on the mood inside LedTable subroutine.
Even more the 4th digit (MSD) is blanked by default (W=0x0A before calling LedTable) because you need to display only values lower than 255 and the application covers 4 digit display.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top