I have a avery basic doubt in this program just because as a newbie in programing I don't understand the delay in this code. I read the books but didn't get how the delay code is works.
The clocl frequency is set at 11 MHz and delay is 25ms. Its hard to understand me that how he select the 250ms delay. Why 1275???
I notice that point that you mention but the code provide 250 ms delay./ I want to know how this routine provide a delay of 250ms. Dividing 11MHz by 12 gives frequency and inverse of the results gives us period which is 1usec. But how he provide a delay of 250ms I don't understand
For calculating this you can just observe the dis assembly in any compiler and based on the instruction you can find out that the delay will be approximately 250ms.
For this you first look at the disassembly of the for condition and you have to count the number of instructions per loop and find the total instructions...
For any controller there is a machine cycles which the hardware execution takes place according to the connected crystal refer it in ur controller and find the delay elapsed.....
the easiest method is passing a big value in delay function and finding the delay using approximation....