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