if you want a delay for a couple of seconds this will suffice: delay: ei ; the interrupts must be enabled for the HALT command to work properly ld b,0 ; since reg b is decremented by djnz, this is equivalent to looping 256 times delay_loop: halt djnz delay_loop ret