• Skip to main content
  • Skip to secondary menu
  • Skip to primary sidebar
  • Skip to footer
Circuits Gallery

Circuits Gallery

All about Electronics and Circuits

  • Home
  • Basics
    • Components
    • Wiring
    • Circuitry
    • Oscilloscope
    • Conductivity
  • Project
    • Using 555 Timer
    • Using Op-Amp
  • MicroController
    • PIC
  • Arduino
  • Simulation
  • Digital
  • Communication
  • How To
  • About Us

What Is Hexa Decimal? Why It Is Used in Microcontrollers?

April 30, 2022 by Charles Clark Leave a Comment

What is Hexadecimal? Hexadecimal numbers are used in Microcontrollers, Microprocessors, etc. The term Hexa Decimal indicates that Hexa – (six) plus Decimal (ten), i.e. Sixteen. The base 16 number system is called Hexadecimal. At the very launch of computer expansion, it was realized that people had many complexities in managing binary numbers. For this reason, a new number system using 16 different symbols was developed. It is called a hexadecimal number system and consists of the ten digits and 6 alphabets, i.e. (0, 1, 2, 3, …. 9, A, B, C, D, E, and F). In this article, we will cover why hexadecimal is used? binary to hexadecimal conversion and hexadecimal to the decimal conversion table.

Need & Importance of Hexadecimal Number Systems

Long before, programmers commonly used a suitable method to handle large binary numbers in 4-bit groupings. It is easy to manipulate large binary numbers if we group them into small groups consisting of 4 bits per group.
For example consider you are dealing with the binary number 0011010110000111, if we group this number to 4-bit clusters like 0011 0101 1000 0111 then write the corresponding single-digit decimal value, the processing is quite easy.

 Thus, 0011010110000111=3587.

What Happens After 9?

While following the above-said method there is a discontinuity that arises after decimal 9. That is how to write decimal corresponding to 1010?

Binary 1010 = Decimal 10, it has 2 digits! Here comes the importance of alphabets…! That is after 9 we use the alphabets A, B, C, D, E, and F for coding. Thus it again retains single-digit up to the number 1111.

 i.e 0011 0101 1000 1010 = 358A

Decimal Binary Hexadecimal Converter Table

Why Hexadecimal? How It Helps Microcontroller Programming

The biggest binary number that can be characterized by 4 binary digits is the number 1111. It corresponds to the number 15 in the decimal system, whereas in the hexadecimal system it can be represented by only one digit i.e ‘F’. It is the largest 1-digit number in the hexadecimal system. In 8 bit PIC microcontroller the largest number is 1111 1111 has 8 bits is at the same time the 2 digit hexadecimal number for 1111 1111 is  ‘FF’. Do you see how skillfully it is used? Don’t forget that computers process 8-digit binary numbers. For the convenient use of programmers, it is easy to manipulate hexadecimal numbers rather than binary numbers. Hexadecimal numbers are represented in the C language by using the prefix ‘0x’.
Eg: 0x25, 0x85 etc.

Hexadecimal in Pic [Real Time Example]

Consider the embedded C program code,
PORTB=0x25;
0x25= 0010 0101
Then the corresponding pins of PORT B are set to logic high, we can connect LEDs for checking the status. See the image below.

Embedded C Program to Realize Hexadecimal

void main()
{
TRISB=0x00;
while(1)
{
PORTB=0x4D;
delay_ms(1000);
PORTB=0xAF;
delay_ms(1000);
}
}

Here we are outing 0x4D and 0xAF to the PORT B continuously with an interval of 1 second. To understand the concept of Hexadecimal in this program, please watch the following PIC simulation.

Conclusion

Hopefully, by this time, you have got a clear picture of the hexadecimal number system and why this is used in microcontrollers. Though binary is used throughout the computational system, hexadecimal still rules in this realm.

Filed Under: Digital, MicroController

Reader Interactions

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Primary Sidebar

More To See

How Far Can You Run Low Voltage Lighting

How Far Can You Run Low Voltage Lighting? Exploring the Limits of Low Voltage Lighting Installations

What is the Difference between RC Coupling and Transformer Coupling

What is the Difference between RC Coupling and Transformer Coupling? In-Depth Guide

Oscilloscope Probe X1 X10 Difference

Oscilloscope Probe X1 X10 Difference | Detection and Compensation of Probes

How to Measure Amps on 240V Circuit With Multimeter

How to Measure Amps on 240V Circuit With Multimeter | Step-By-Step Guide

More About

  • Arduino
  • Basics
  • Circuitry
  • Communication
  • Components
  • Conductivity
  • Digital
  • How To
  • MicroController
  • Oscilloscope
  • PIC
  • Project
  • Simulation
  • Using 555 Timer
  • Using Op-Amp
  • Wiring

Footer

QUICK LINKS

  • About Us
  • Privacy Policy
  • Terms and Conditions
  • Contact

AFFILIATE DISCLOSER

Circuits Gallery is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for website owners to earn advertising fees by advertising and linking to amazon (.com, .co.uk, .ca etc) and any other website that may be affiliated with Amazon Service LLC Associates Program

© 2023 · Circuits Gallery | All Rights Reserved