sir, for delay in micro controller, everytime we have to use TMOD and TR and enable corresponding interrupt.is there any other less tedious way of programing a delay using keil cross compiler. regards, malay lakhani final year BE student, mumbai
You could alway use a for loop. But you have to time it by hand, And, it can change time if you change the compiler or optimization. make a function called delay that sets the timer and waits for it to be done. Then use it over and over.
You could just leave the hardware timer running permanently. Have a start_timer() function that sets some global to some suitable value; Each timer interrupt then decrements the global; When the global reaches zero, your time is up! You can easily extend this to support several simultaneous timers...