📄 prog44a.asm
字号:
; 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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -