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.

[General] 2 byte Hex to BCD Conversion in C under keil

Status
Not open for further replies.

samskruthi

Newbie level 1
Newbie level 1
Joined
Jun 8, 2013
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Visit site
Activity points
7
Hello friends

I am trying to convert 2 bytes hex value ( may be 0xa45) to bcd . but feeling difficult for the conversion during handling overflow. can u please any body suggest the logic of conversion . Please ping me back as soon as possible. thank you :-:)|.

I am able to perform 1 byte conversion as discussed in edaboard. please revert for 2 bytes conversion logic if any familiar with.
 

Code:
unsigned int uiValue = 0x202;
unsigned int uiResult = 0;

while (uiValue > 0) {
   uiResult <<= 4;
   uiResult |= uiValue % 10;
   uiValue /= 10;
}
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top