Program LED menyala sesuai dengan penekanan switch:
; ============
; Judul: Program Input Push Button & Output LED
; Port : Port0 => DISPLAY LED
; Port1 => -
; Port2 => -
; Port3 => INPUT PUSH BUTTON
; Ket : LED menyala sesuai dengan penekanan switch
; -----------
; By : ARC. Robotica Club
; ===============
$MOD51
ORG 0000H
AJMP START
ORG 0100H
DELAY: MOV R5, #04H
DEL1: MOV R6, #002H
DEL2: MOV R7, #0BFH
DJNZ R7, $
DJNZ R6, DEL2
DJNZ R5, DEL1
RET
START: MOV SP, #30H
LOOP:
MOV A, P3 ; read switch
CPL A ; inverse
MOV P0, A ; write LED
SJMP LOOP
END
comment 0 komentar
more_vert