Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Binary Coded Decimal (BCD) Conversion for Microcontrollers, Summaries of Microcontrollers

This document from the New Mexico Institute of Mining and Technology covers the concept of Binary Coded Decimal (BCD) conversion for microcontrollers. what BCD is, how it differs from binary representation, and provides examples of converting binary to decimal using both C and Assembly language. It also covers the conversion of hexadecimal to ASCII.

What you will learn

  • What is the process of converting hexadecimal to ASCII using Assembly?
  • How can we convert binary to decimal using Assembly?
  • How can we convert binary to decimal using C?
  • What is Binary Coded Decimal (BCD) and how does it differ from binary representation?
  • What is the process of converting hexadecimal to ASCII using C?

Typology: Summaries

2021/2022

Uploaded on 09/27/2022

paperback
paperback 🇺🇸

4.8

(12)

264 documents

1 / 12

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
EE 308: Microcontrollers
Binary Coded Decimal
Aly El-Osery
Electrical Engineering Department
New Mexico Institute of Mining and Technology
Socorro, New Mexico, USA
February 21, 2019
Introduction Conversion ASCII
Aly El-Osery (NMT) EE 308: Microcontrollers February 21, 2019 1 / 9
pf3
pf4
pf5
pf8
pf9
pfa

Partial preview of the text

Download Binary Coded Decimal (BCD) Conversion for Microcontrollers and more Summaries Microcontrollers in PDF only on Docsity!

EE 308: Microcontrollers

Binary Coded Decimal

Aly El-Osery

Electrical Engineering Department New Mexico Institute of Mining and Technology Socorro, New Mexico, USA

February 21, 2019

Introduction Conversion ASCII

What is BCD?

It is more natural for us to think in terms of decimal numbers with representation of

0 to 9.

Introduction Conversion ASCII

What is BCD?

It is more natural for us to think in terms of decimal numbers with representation of

0 to 9.

Digital systems represent numbers in binary.

How can we manipulated digital system to display numbers in our favorite format.

Introduction Conversion ASCII

What is BCD?

It is more natural for us to think in terms of decimal numbers with representation of

0 to 9.

Digital systems represent numbers in binary.

How can we manipulated digital system to display numbers in our favorite format.

Using Binary Coded Decimal (BCD)

Introduction Conversion ASCII

Binary to decimal

How we can break the number into its individual digit? (00-FF to 000-255)

Introduction Conversion ASCII

Binary to decimal using C

unsigned char x , tmp ;

tmp = x / 10; d1 = x % 10; //least significant digit d2 = tmp % 10; //middle digit d3 = x / 10; //most significant digit

Introduction Conversion ASCII

ASCII table

How can we display numbers (for exmaple using an LCD)

Introduction Conversion ASCII

Hex to ASCII using C

unsigned char x ; unsigned char hexnum = 0 x56 ; unsigned lsb_digit , msb_digit ;

x = hexnum & 0 x0F ; //grap the lower 4 −bits lsb_digit = x | 0 x30 ; //convert lsb to ascii

x = hexnum & 0 xF0 ; //grap the upper 4 −bits x = x > >4; //shift to lower 4 −bits msb_digit = x | 0 x30 ; //convert msb to ascii

Introduction Conversion ASCII