You didn't specified the crystal value and the microcontroller you are using...
But it seems MCS 51.
So lets assume you have 12MHz clock with an old 8051...
For 12 MHz,
12 Mhz/12= 1MHz (Effective clock to the core)
( 1 / 1MHz ) = 1us (minimum time for single execution)
(65536-xx)*1us= 50 ms (50ms is the perfect round figure 'with' highest delay by timer MODE 1)
(65536-xx)=50,000 (50ms = 50,000 microsecond)
xx=15536
in hex it is
xx=3CB0H
You can use window calculator for conversion from decimal to hexadecimal
now
TH0=03CH
TL0=0B0H
Now you got the timer high and low values...
For 1s delay, write code in the following manner..
Code:
delay:
mov TMOD,#01H ; mode 16bit, timer 0
mov TH0,#03CH ;
mov TL0,#0B0H ;
mov r1,#20 ; repeated 20 times (50ms x 20 = 1s)
setb TR0 ; start timer
wait:
jnb TF0,wait
clr TF0
clr TR0
mov TH0,#03CH
mov TL0,#0B0H
setb TR0
djnz r1,wait
.
.
.
.