Counters & Time Delays: Counter
Counters & Time Delays: Counter
Counters & Time Delays: Counter
Counter:
Delays
A counter in 8085 is a sequence of instructions designed to count the number of occurrences
of an event or to count down a specific value.
•Usage: Counters are used in loops where the microprocessor needs to repeat an operation
a specific number of times. For example, counting the number of pulses, steps, or iterations
in a loop.
Time Delay:
A time delay is a method used to pause or delay the execution of the program for a specific
period.
•Usage: Time delays are crucial in controlling the timing of hardware interactions, creating
pauses between operations, or synchronizing events.
Counters & Time Delays
• Delay loop: We can use a loop to produce a certain amount of time delay in a program.
To calculate the delay, we use the following formula: Tdelay = delay outside the loop (TO) +
delay of the loop (TL )
Delay Calculations
The delay loop includes two instructions: DCR C and JNZ
with 14 T-states. Therefore, the time delay T in the loop
(without accounting for the fact that JNZ requires seven T-
states in the last cycle) is T= 14 T-states x T (Clock
period) x Count = 14 x (0.5 uS) x Count = = (7.0 uS) x
Count
8C
T-states Total
Time Delay TD = To + TL
1 ms = 17.5 uS + (7.0 uS) x Count
Count = 8CH
Practice problem