Thaimicrotron.com : Home | ||
EXAM-1 การใช้งาน
PORT พื้นฐาน |
||
ผลการทดลอง | ||
EXAM1 | ||
;EXAM1.ASM ;Move LED Left and out to P1 ; ORG 0000H ;Start at 0000H MAIN: MOV A,#11111110B ;Initial data LOOP: MOV P1,A ;move to port P1 LCALL DELAY ;call delay in second input in R2 RL A ;Rotate A left one bit LJMP LOOP ;jmp to lable LOOP ;END MAIN DELAY: MOV R2,#5 ;wait 0.5 sec LCALL DTSEC ;call delay in 1/10 second input in R2 RET ; ********** DTSEC SUB ********** ; DELAY 1/10 SECOND ; IN = R2 ; REG = R2,R3,R4 DTSEC: MOV R3,#179 DTSEC1: MOV R4,#0 DTSEC2: DJNZ R4,DTSEC2 NOP NOP DJNZ R3,DTSEC1 DJNZ R2,DTSEC RET END |
||