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.

Ascii to BCD Conversion

Status
Not open for further replies.

gauravkothari23

Advanced Member level 2
Joined
Mar 21, 2015
Messages
640
Helped
5
Reputation
10
Reaction score
4
Trophy points
1,298
Activity points
6,921
Hi all.
I am making a simple project where i need to display the contains of Array to seven segment display.
for ex.
unsigned char array[4]={"1234"};
also i have four seven segment displays where i need to display 1 to segment 1, 2 to segment 2, 3 to segment 3, 4 to segment 4.
common anode segments are connected to PORT 1 of 89S52 Microcontroller.
how can i do it. can anybody provide me some logics to do it.
 

No need to convert to BCD, just create a second array containing the bit pattern of segments and drive the port with it directly.

hint: think of the segments as bits in the port, for example segment A = bit 0, segment B = bit 1 and so on. Then work out the bit pattern and hence numeric value for the segments you want lit for each digit.

also i have four seven segment displays where i need to display 1 to segment 1, 2 to segment 2, 3 to segment 3, 4 to segment 4
Be careful not to confuse segments and digits. A digit is the whole display module consisting of seven segments and maybe a decimal dot, a segment is the individual bar that makes up the shape of the digit.

Brian.
 

Also be aware that strings in most compilers are null terminated which mean that "1234" is actually 5 characters long.
Susan
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top