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

📄 bin4f.asm

📁 代码保护功能处于持续发展中。Microchip 承诺将不断改进产品的代码保护功能。任何试图破坏Microchip 代码保护功能的行为均可视 为违反了《数字器件千年版权法案(Digital Mille
💻 ASM
字号:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
;       Source File:	BIN4F.ASM		
;	Author:		MPB              
;	Date:		24-11-05      
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
;	Output binary count is stopped, started
;       and reset with push buttons. 
;	
;	Modified for fast count 
;	Delay call commented out
;
;       Processor:      PIC 16F877
;
;       Hardware:       PIC Demo System    
;       Clock:          RC = 100kHz
;       Inputs:         Port D: Push Buttons 
;				RD0, RD1 (active low)
;       Outputs:        Port B: LEDs (active high)
;       
;       WDTimer:        Disabled
;       PUTimer:        Enabled
;       Interrupts:     Disabled
;       Code Protect:   Disabled
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 

	PROCESSOR 16F877	; Define MCU type
	__CONFIG 0x3733		; Set config fuses

; Register Label Equates....................................
        
PORTB   EQU     06	; Port B Data Register  
TRISB	EQU	86	; Port B Direction Register
PORTD   EQU     08	; Port D Data Register
Timer   EQU     20	; GPR used as delay counter

; Input Bit Label Equates ..................................

Inres   EQU     0	; 'Reset' input button = RD0
Inrun   EQU     1	; 'Run' input button = RD1

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

; Initialise Port B (Port A defaults to inputs).............
        
	BANKSEL	TRISB		; Select bank 1
       	MOVLW   b'00000000'    	; Port B Direction Code
    	MOVWF	TRISB          	; Load the DDR code into F86
	BANKSEL	PORTB		; Select bank 0
	GOTO	reset		; Jump to main loop


; 'delay' subroutine ........................................
        
delay  	MOVWF  	Timer          	; Copy W to timer register
down    DECFSZ 	Timer          	; Decrement timer register 
        GOTO   	down           	; and repeat until zero
	RETURN			; Jump back to main program


; Start main loop ...........................................

reset   CLRF    PORTB  		; Clear Port B Data 

start   BTFSS  	PORTD,Inres    	; Test reset button
       	GOTO   	reset          	; and reset Port B if pressed
        BTFSC  	PORTD,Inrun    	; Test run button
        GOTO  	start          	; and repeat if n pressed

        INCF   	PORTB          	; Increment output at Port B 
	MOVLW  	0FF            	; Delay count literal
;	CALL	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 + -