prog34.asm

来自「包括了各种常用的8051单片机的程序」· 汇编 代码 · 共 54 行

ASM
54
字号
;  PROG34 -  Testing the Decoupling Capacitor 
;
;  This Application "Marches" a series of LEDs Across P1 and P3 to Try and 
;   Force a Reset or Device Lock Up.  
;
;  Myke Predko
;  98.03.10
;
;  Hardware Notes:
;  80C520 Running at 4 MHz
;  P1 is Connected to a Set of LEDs
;  P3 is Connected to a Set of LEDs

;  Variable Declarations
;  R0 - R1 Is used for the Program Delay
;  020h - 021h is Used for the LED Bit States 

 org 000h

  mov   020h,#0FFh              ;  Set the LEDs to All OFF
  mov   021h,#0FFh

Loop:                           ;  Loop Here for Each LED Set

  mov   P1,#0FFh                ;  Turn Off ALL the LEDs
  mov   P3,#0FFh

  acall Dlay                    ;  Dlay 1/4 Second Before Doing the Turn-On

  mov   C,15                    ;  Complement Bit 15 for the Low Order Bit
  cpl   C

  mov   A,020h                  ;  Shift Up the Lower 8 Bits
  rlc   A
  mov   P1,A                    ;  Store in the Output Register
  mov   020h,A                  ;  Save the New Value

  mov   A,021h                  ;  Shift up the Upper 8 Bits
  rlc   A
  mov   P3,A                    ;  Store in the Output Register
  mov   021h,A                  ;  Save the New Value

  acall Dlay                    ;  Delay another 1/4 Second

  ajmp  Loop                    ;  Loop Around

Dlay:                           ;  Delay 1/4 Second

  djnz  R0,Dlay                 ;  Do a Simple Loop

  djnz  R1,Dlay

  ret

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?