Demo entry 6655742

code

   

Submitted by anonymous on Oct 28, 2017 at 04:47
Language: ca65 assembler. Code size: 713 Bytes.

$include (C8051F020.INC)
INIT: LCALL Init_Device

MOV TMOD, #01    ;Set the Timer0 and Mode1
MOV A,#0FFH      ;Initializing A

LOOP:            ;Start the Loop to light the bulb
MOV P3, A
DEC A            ;Decrease A
ACALL DELAY      ;Call the delay
SJMP LOOP        ;Jump back to LOOP

DELAY:            
MOV TL0, #03CH    ;Initializing the TL and TH
MOV TH0, #0B0H
MOV R0,#100      ;The times of LOOP
LOOP1:
SETB TR0          ;Run Timer0
AGAIN:
JNB TF0, AGAIN    ;Detect the TF to check overflow bit
MOV TL0, #0C0H    ;if the overflow bit is change then re-initialize
MOV TH0, #63H
CLR TF0           ;Clear TF0 and TR0
CLR TR0
DJNZ R0, LOOP1


RET


$include (Init_Device.inc)
END

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).