📄 bin4d.asm
字号:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; Source File: BIN4D.ASM
; Author: MPB
; Date: 13-11-05
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
; Slow output binary count is stopped, started
; and reset with push buttons.
; Modified with extra directives
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Declare processor, supress messages and warnings,
; do not print symbol table, and configure (RC clock)
LIST p=16f877a, w=2, st=off, mm=off
__CONFIG 0x3733
; Declare GPR label and literal constant
; Define input labels
; Include standard SFR label file
; Include PortB initialisation file
Timer EQU 20
DDCodeB SET b'00000000'
CONSTANT Count=003
#DEFINE RunBut PORTD,1
#DEFINE ResBut PORTD,0
#INCLUDE "P16F877A.INC"
#INCLUDE <BOUT.INI>
; Program code ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; 'delay' macro .............................................
delay MACRO ; macro definition starts
MOVWF Timer ; Copy W to timer register
down DECF Timer ; Decrement timer register
BNZ down ; and repeat until zero
ENDM ; macro definition ends
; Main loop .................................................
reset CLRF PORTB ; Clear Port B Data
start BTFSS ResBut ; Test reset button
GOTO reset ; and reset Port B if pressed
BTFSC RunBut ; Test run button
GOTO start ; and repeat if n pressed
INCF PORTB ; Increment output at Port B
MOVLW Count ; Delay count literal
delay ; Jump to subroutine 'delay'
GOTO start ; Repeat main loop always
END ; Terminate source code......
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -