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

📄 prog21.asm

📁 主要是8051源代码
💻 ASM
字号:
;  PROG21 - Psuedo-Random LED Display
;
;  This Application Displays a psuedo Random 16 Bit Number
;   Generated by a single Tap CRC at Bit 10 (XOR'd with Bit 15).
;
;  The LSB is Bit 10 ^ Bit 15
;           = ( !Bit 10 & Bit 15 ) | ( Bit 10 & !Bit 15 )
; 
;  This algorithm will give about 61K Different Patterns
;  
;  A Quarter Second Delay is placed between Every New LED Pattern.  
;
;  This display is suitable for Doing Christmas Lights.  
;
;  Myke Predko
;  98.02.22
;
;  Hardware Notes:
;  80C520 Running at 4 MHz
;  P1.0-7 Connected to LEDs
;  P3.0-7 Connected to LEDs

;  Variable Declarations
;  Just "A" is used for this program.  

;  Mainline
 org 0                          ;  Execution Starts Here

Loop:                           ;  Loop Here Forever

  mov    C,P3.2                 ;  Get the Bits to AND Together
  cpl    PSW.7                  ;   Invert Bit 13
  anl    C,P3.7                 ;   AND it with Bit 15
  mov    ACC.0,C                ;  Save it for Later

  mov    C,P3.7                 ;  Now, Get Bit13 * !Bit15
  cpl    PSW.7
  anl    C,P3.2

  orl    C,ACC.0                ;  OR Both Values Together in Carry

  mov    A,P1                   ;  Now, Update the 16 LED Display
  rlc    A
  mov    P1,A
  mov    A,P3
  rlc    A
  mov    P3,A

  acall  Dlay                   ;  Leave Like this for 500 msec

  sjmp   Loop                   ;  Loop Around Again

Dlay:                           ;  Delay 263 msec

  clr    A
  mov    B,#0                   ;  Longest Delay Possible

DlayLoop:                       ;  Loop Here for 500 msec
  djnz   ACC,DlayLoop           ;  Inside Loop
  djnz   B,DlayLoop

  ret

⌨️ 快捷键说明

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