⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 prog23.asm

📁 主要是8051源代码
💻 ASM
字号:
;  PROG23 - Scratchpad RAM Values on Power Up
;
;  This Application Outputs the value for each scratchpad RAM location
;   from 0 to 32 using the LEDs from PROG21 and a Switch to Increment 
;   the Counter.    
;
;  Myke Predko
;  98.02.23
;
;  Hardware Notes:
;  80C520 Running at 4 MHz
;  P1.0-7 Connected to LEDs - Displays the Values
;  P3.0-6 Connected to LEDs - Displays the Address
;  P3.7 Connected to a Pull-Down Momenatary "On" Switch

;  Variable Declarations
;  R0, once it has been Read is used as an Index into the Internal RAM  

;  Mainline
 org 0                          ;  Execution Starts Here

  mov    A,R0                   ;  Get the First Address
  cpl    A                      ;  Invert the Value
  mov    P1,A                   ;  Store It

  mov    R0,#1                  ;  R0, Now Starts to Point to Other Locations

MainLoop:                       ;  Loop Here for Each Address

ReleaseLoop:                    ;  Wait for the Button to be Released
  jnb    P3.7,ReleaseLoop       ;   Loop While the Button is Low

PressWait:			;  Wait for the Button to be Pressed
  jb	 P3.7,PressWait

  mov	 A,#191			;  Setup 20 msec Delay
  mov	 B,#10

PressDebounce:			;  Now, See if the Button is Held down
  jb	 P3.7,PressWait		;   20 msec - If Released, Start Delay Over
  djnz	 ACC,PressDebounce	
  djnz	 B,PressDebounce

  dec    P3                     ;  Show the Address of the Byte Being Displayed

  mov    A,@R0                  ;  Get the Value Pointed to by R0
  cpl    A
  mov    P1,A                   ;   And Display it Inverted

  inc    R0                     ;  Point to the Next Address

  mov    A,P3                   ;  Are we At the End of the Display?
  anl    A,#07Fh                ;   Check to See if the Lower 7 Bits are Reset
  jnz    MainLoop               ;   If Not, Can Loop Again

Loop:                           ;  Done - Loop Forever
  ajmp   Loop

⌨️ 快捷键说明

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