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
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. […]
Read array of 10 integers and displaying them. “Array is the limited storage(as size mentioned) with ordered series or arrangement of same kind of data(int or float or char)” Example :Input is asked as : Enter the Array elements, Enter Values like 00,10,20,30,40,50,60,70,80,90 are stored in particular space of array. Example: – This represents that […]