## 8051 code find sum of first N natural numbers

Hello, guys! Today we will see 8051 assembly program to find the sum of first N natural numbers. There are two ways to compute the sum of N natural numbers. We will go through one by one. First method: It’s simple basic code. Let’s go through the algorithm. Algorithm: Start Store the value(N) up to which sum has […]

## 8051 program to convert Ascii value to Hexadecimal value….

Hi guys…In this article let’s learn conversion.The ascii to Hex conversion logic is very simple.The hexadecimal numbers from 31H-39H are 0-9 numbers in ascii and 41H to 46H are A to F numbers. So we should first compare the number with 40H if it is lesser subtract with 30H and it is greater subtract with […]

## 8051 itimer interrupt program to display value of 'Y' at P0 and 'n' at P2. Also generate square wave of 10 KHz at P2^0 with timer0 in interrupt mode.Using XTAL@22MHz

I have explained the calculations for the timer in my previous post.please have a look . CODE:

## 8051 timer Interrupt program to copy data from P0 to P1 ,while simultaneously generating square wave of time period 200 uS at P2^0 .

When it comes to interrupt programming , we have to consider some important registers. For this program the registers used are IE(interrupt enable),TCON(timer control),TMOD(timer mode).     In timer interrupt programming calculating the value to be loaded to the timer is very important. Here XTAL frequency i have considered is 11.0592 MHz.If you are using […]

## 8051 Interrupts: Basics | Types | Programs |Timer interrupts | AT89C51

8051 Interrupts An Interrupt is an external or internal event that halts or interrupts Microcontroller to inform it that a device needs its service.    Contents: 1. Basics.2. Steps taken when interrupt occurs. 1. Basics :        A microcontroller is able to give service to many Input and Output devices connected to it. […]

## 8051 Program to Rotate DPTR value

Output 8051 Program to Rotate DPTR Value.  ALGORITHM: Start. Load the value to be rotated in DPTR. Move the Lower nibble of DPTR in Accumulator. Rotate Left 8 bits along with carry. Move the Upper nibble of DPTR in Accumulator. Rotate Left 8 bits along with carry. Now we got the Upper nibble of DPTR […]

## 8051 16 bit multiplication Program- Codes Explorer

8051 16 Bit Multiplication ALP  ALGORITHM: Start. Load the MSB’s of Data in two different registers. Load the LSB’s of Data in other two different registers. Successive multiplication is carried out. The product obtained in the registers. The output is stored in the registers. End. For example if we are trying to multiply two 16 […]

## Interfacing Seven Segment Display on 8051- C Code { Common Anode}

This code is a simple one . Here just a 7 seg display is attached to Port 0 of 8051 micro controller . The values can be calculated easily . One unit of 7 seg display has 7 different leds as its segments and also a dot at the bottom left corner. Hence the 8 […]

## Embedded C to find the number of one's in a given 32bit number and optimize the code

Embedded C to find the number of one’s in a given 32bit number and optimize the code In this article let’s learn how to optimize a program.The program which is used for optimization is to find number of ones in a given 32bit number. First let’s write a simple code and then let’s see how […]

## 8051 ALP to generate look up table for first 10 odd numbers

Have a look at my older program on how to find an odd number…