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 different frequencies,the just divide the XTAL/12.Then inverse the obtained answer.This will be the time required to complete one machine cycle.Hence for my 11.059 MHz the time will be 1.085 uS .
Now the time period of the square wave required is 200 uS .Therefore now we have to calculate the no of cycles required to generate 200 uS of delay so that the output switches between 0 and 1 to generate a square wave.
N=200 uS/ 1.085 uS = 184.33179 = 184
Using timer 0 in 8 bit auto reload mode we can generate the given delay. Value to be loaded to the TH0,TH1 can be calculated as follows
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 […]
Program to find the sum of all negative numbers stored in an array. This program finds the negative numbers in an array and adds them.Basically negative number is one whose carry bit is 1. Algorithm 1)Initializing register R0 with the array address and register R1 with counter. 2)Storing the first value of array in accumalator. […]
Let’s see how to write a ARM assembly code to find number of positive numbers in an array. ALGORITHM Start Load the base address of array. Initialize a counter register to number of elements in array. Initialize a register(Rd) to zero to store number of positive numbers. Load the value from array to a temporary […]