Delay Programusing8051
Delay Programusing8051
Dr P.T.Vanathi
🞂 For an 8051 microcomputer a single instruction cycle is
executed for every 12 clock cycles of the
processor clock.
🞂 Thus, for an 8051 clocked at 12MHz. the instruction
cycle time is one microsecond, as follows:
🞂 Instruction cycle time = 12 clock cycles/ 12 x 106
cycles/sec, or 1 μsec.
🞂 The shortest instructions will execute in one instruction
cycle(machine cycle), i.e. 1 μsec.
🞂 Other instructions may take two or more instruction cycle
times to execute 12 clock cycles
Instruction Timing
🞂 One “machine cycle” = 6 states (S1 - S6)
🞂 One state = 2 clock cycles
◦ One “machine cycle” = 12 clock cycles
🞂 Instructions take 1 - 4 cycles
◦ e.g. 1 cycle instructions: ADD, MOV, SETB, NOP
◦ e.g. 2 cycle instructions: JMP, JZ
◦ 4 cycle instructions: MUL, DIV
org 100h
Main: clr GREEN_LED
main program
Again: acall Delay
cpl GREEN_LED
sjmp Again
djnz R5, $