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 […]

# Author: abhay

## C++ Program to Swap two numbers.

“Swapping of integers is defined as the variables that are interchanged after swapping the variables,called as Swapping of integers” Example: If the input is given as a=5 and b=4 (before Swapping) The output will be as a=4 and b=5 (after Swapping). Input: a=20 and b=40, before swapping. Output: a=40 and b=20, after swapping. […]

## 8051 Program to find 10 fibonacci numbers and store it an array.

Program to find 10 fibonacci numbers and store it an array. In this article let’s learn how to find fibonacci numbers and store it in an array. Basically fibonacci number is a series where each term is the sum of previous two numbers. Algorithm: 1)Store the memmory address in R0 and counter in R3. 2)Store […]

## 8051 Assembly code to find average of all numbers stored in array

We use Indirect addressing mode to access arrays in 8051, because it is efficient and has advantage of accessing adjacent address locations with one base address. So, lets see how to find average of all numbers stored in an array. ALGORITHM: Start Initialize a register with base address of memory location where array is stored […]

## Interfacing LCD with 8051 using Keil C – AT89C51

LCD Interfacing-8051 AT89C51xD2 Introduction: A 16*2 Alphanumeric display with backlight is provided on Evaluation Board. Liquid Crystal Display (LCD) is widely used electronic display module and having a wide range of applications such as calculators, laptops, mobile phones etc. LCD in ALS 8051 Evaluation Board is connected to Port P2. Before we initialise the LCD Let us understand […]

## DC Motor Interfacing with 8051 Microcontroller – CodesExplorer

DC Motor Interfacing with 8051 Microcontroller Fig 1 DC Motor This Code is specially developed for ALS 8051 Evaluation Board. A DC motor is basically converts direct current electrical energy into mechanical energy. They have a wide range of applications in bots and in other electronic devices.By interfacing DC motor to the microcontroller, we can do many things […]

## Stepper Motor Interfacing with 8051 Microcontroller – CodesExplorer

Stepper Motor Interfacing with 8051 Microcontroller Fig 1. Stepper Motor A stepper motor is a brushless motor which divides complete 360 degree rotation into steps. Each step has fixed angle and motor rotates along those angles.In this article we will be interfacing Stepper Motor with 8051 Microcontroller. In this article we will be rotating stepper […]

## ARM Code: Find whether number is Prime or Not

ARM Assembly Code to find whether the given number is Prime or Not This code is tested in Keil uVision 4. Developed for ARM LPC2148 by Abhay Kagalkar ARM Code :

1 |
AREA Prime_or_Not,code,readonly <br /> ENTRY <br /> MOV R0,#15 ;Number which you want to test<br /> CMP R0,#01 ;Comparing with 01<br /> BEQ PRIME ;If equal declare directly as prime<br /> CMP R0,#02 ;Compare with 02<br /> BEQ PRIME ;If equal declare directly as prime<br /> MOV R1,R0 ;Copy test number in R1<br /> MOV R2,#02 ;Initial divider<br />UP <br /> BL DIVISION ;Call for division sub-function<br /> CMP R8,#00 ;Compare remainder with 0<br /> BEQ NOTPRIME ;If equal then its not prime<br /> ADD R2,R2,#01 ;If not increment divider and check<br /> CMP R2,R1 ;Compare divider with test number<br /> BEQ PRIME ;All possible numbers are done means It's prime<br /> B UP ;If not repeat until end<br />NOTPRIME <br /> LDR R3,=0x11111111 ;Declaring test number is not prime<br /> B STOP ;Jumping to infinite looping<br />PRIME <br /> LDR R3,=0xFFFFFFFF ;Declaring test number is prime number<br />STOP B STOP ;Infinite looping<br /><br />DIVISION ;Function for division operation<br /> MOV R8,R0 ;Copy of data from main function<br /> MOV R9,R2 ;Copy of divider from main function<br />LOOP <br /> SUB R8,R8,R9 ;Successive subtraction for division<br /> ADD R10,R10,#01 ;Counter for holding the result of division<br /> CMP R8,R9 ;Compares for non-zero result<br /> BPL LOOP ;Repeats the loop if subtraction is still needed<br /> MOV PC,LR ;Return back to main function<br /> END <br /> |

Output Pic : Download Code: To Download the Code click on the link below:

## ARM Code: Length of carriage return terminated String

ARM Assembly Code to find the length of Carriage return terminated string This code is tested in Keil uVision 4. Basically The Carriage Return (CR) character (0x0D, r) moves the cursor to the beginning of the line without advancing to the next line. This character is used as a new line character in Commodore and […]

## LCD Interfacing-ARM LPC2148 Embedded C

LCD Interfacing-ARM LPC2148 Introduction: This Code is specially developed for LCD on ALS ARM LPC2148 Evaluation Board. A 16*2 Alphanumeric display with backlight is provided on Evaluation Board. Mode of Operation:- LCD is interfaced using 4 bit Mode. Port Details: P0.2 to P0.7 are used for LCD interfacing. RS = 0 for sending Command to […]