📄 prog29.asm
字号:
; PROG29 - Working through the Emulator
;
; Start with the Serial Interface.
;
; This Application waits for 2 Seconds and then Sends "A" by "Bit Banging" to
; the Console. Note that Variables at at Address 080h and Greater.
;
; Myke Predko
; 98.06.25
;
; Hardware Notes:
; DS87C520 is used as the Microcontroller
; - Oscillator Speed is 20 MHz
; P2.7 is Console Serial Output
; Constant Declarations
define SerOut=P2.7 ; Serial Output Bit
; Variable Declarations
; Macros
; Mainline
org 0 ; Execution Starts Here
MainLine: ; Mainline of the Program
mov R2,#54 ; Delay for 2 Seconds
mov R1,#0
mov R0,#0
LongDlay:
djnz R0,LongDlay
djnz R1,LongDlay
djnz R2,LongDlay
mov A,#'A' ; Send the "A" Character
acall SendChar
ajmp Mainline ;
; Subroutines
SendChar: ; Send the Serial Character
mov R0,#10 ; We're Actually Sending 10 Bits
clr C ; First Bit is a "0"
SCLoop: ; Loop Here for Each Bit
mov SerOut,C ; Output the Bit in the Carry Flag
mov R1,#170 ; Delay to 104 usecs (520 Cycles) per loop
SCLoop1:
djnz R1,SCLoop1
nop
setb C ; Shift the Next Bit to Carry
rrc A ; And Load in a "1" for Stop Bit
djnz R0,SCLoop
ret
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -