prog44a.asm

来自「主要是8051源代码」· 汇编 代码 · 共 47 行

ASM
47
字号
;  PROG44a - Output a Tone from an AT89C2051  
;
;  Simple Application to Test the Interrupt Handler Code.
;
;  This Application after power up, Sets up Timer 0 to Interrupt at
;   880 Hz and Outputs a 440 Hz Tone.  
;
;  Myke Predko
;  98.05.29
;
;  Hardware Notes:
;  AT89C2051 is used as the Microcontroller
;   - Oscillator Speed is 1.8432 MHz
;  P1.7 is Connected to a 8 Ohm Speaker Through 0.47 uF Cap

;  Constant Declarations

;  Variable Declarations


;  Macros


;  Mainline
 org 0                          ;  Execution Starts Here
  ajmp    Mainline

 org 00Bh                       ;  Timer0 Interrupt
Timer0:

  cpl     P1.7                  ;  Toggle the Timer

  reti


MainLine:                       ;  Mainline of the Program

  mov     TMOD,#%00000010       ;  Run Timer0 in Mode 2
  mov     TH0,#81               ;  Enable the Timer to Reload at 880 Hz.  
  mov     TL0,#81
  orl     TCON,#010h            ;  Enable Timer0 to Run

  mov     IE,#%10000010         ;  Enable Timer0 Interrupt

Loop:
  ajmp    Loop

⌨️ 快捷键说明

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