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

📄 led1s.asm

📁 代码保护功能处于持续发展中。Microchip 承诺将不断改进产品的代码保护功能。任何试图破坏Microchip 代码保护功能的行为均可视 为违反了《数字器件千年版权法案(Digital Mille
💻 ASM
字号:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;
;       Source File:	LED1S.ASM		
;	Author:		MPB              
;	Date:		2-12-05      
;
;	Output binary count is stepped manually
;       and reset with push buttons. 
;	Demonstrates software delay switch debounce
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 

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

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

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

; Initialise Port B (Port A defaults to inputs).............
        
	BANKSEL	TRISD		; Select bank 1
       	MOVLW   b'00000000'    	; Port B Direction Code
    	MOVWF	TRISD          	; Load the DDR code into F86
	BANKSEL	PORTD		; 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    PORTD  		; Clear LEDs 

start   BTFSS  	PORTB,1   	; Test reset button
       	GOTO   	reset          	; and clear LEDs
        BTFSC  	PORTB,2 	; Test step button
        GOTO  	start          	; and repeat if not pressed

	MOVLW  	0FF            	; Delay count literal
	CALL	delay		; Wait for count
        BTFSS  	PORTB,2  	; Test step button
        GOTO  	start          	; and wait if not released
        INCF   	PORTD          	; Increment LEDs 
        GOTO   	start          	; Repeat always

        END                   	; Terminate source code

⌨️ 快捷键说明

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