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

📄 prog28.asm

📁 主要是8051源代码
💻 ASM
字号:
;  PROG28 -  Interfacing to an SRAM 
;
;  This Application Reads and writes to the 8K by 8 SRAM Connected to
;   the P0/P2 Bus.  
;
;  Myke Predko
;  98.03.10
;
;  Hardware Notes:
;  80C520 Running at 4 MHz
;  P1.0 is Connected to a Set of LEDs
;  P3.2 is Connected to momentary On Pull Down Button
;  P0/P2 I/O Bus wired to a 6264 8Kx8 SRAM with a 74LS373 for Address Buffering

;  Variable Declarations

 org 000h
  mov   DPTR,#0                 ;  Initialize DPTR to the I/O Address

Loop1:                          ;  Load the SRAM

  mov   A,DPL                   ;  Do an Data == Address Test

  movx  @DPTR,A                 ;  Save the Low 8 Bits of the Address

  inc   DPL                     ;  Point to the Next Address

  mov   R0,DPL

  cjne  R0,#0,Loop1             ;  Do until the First 256 Bytes of SRAM
                                ;   Loaded

Loop2:                          ;  Now, Compare the Data

  movx  A,@DPTR                 ;  DPL is at 0 Again

  xrl   A,DPL                   ;  Does the Data Match the Address?

  jnz   Error                   ;  No, Show the Error Address

  inc   DPL                     ;  Else, Try the Next Address

  mov   R0,DPL

  cjne  R0,#0,Loop2

  inc   DPH                     ;  Now, Repeat with the Next 256 Addresses

  ajmp  Loop1


Error:                          ;  Miscompare, Show the Expected/Actual on the LEDs

  movx  A,@DPTR                 ;  Read the Value Again
  
  mov   P1,A                    ;  Display on P1's LEDs

  mov   P3,DPL                  ;  Display the Expected 

Loop3:                          ;  The Read/Write worked Okay, Just Loop

  ajmp  Loop3                   ;  Now, Loop forever

⌨️ 快捷键说明

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