📄 bin4f.sdi
字号:
,,,;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
,,,;
,,,; 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
00002007,3733,, __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).............
,,,
00000000,1683 1303,, BANKSEL TRISB ; Select bank 1
00000002,3000,, MOVLW b'00000000' ; Port B Direction Code
00000003,0086,, MOVWF TRISB ; Load the DDR code into F86
00000004,1283 1303,, BANKSEL PORTB ; Select bank 0
00000006,280B,, GOTO reset ; Jump to main loop
,,,
,,,
,,,; 'delay' subroutine ........................................
,,,
00000007,00A0,delay,delay MOVWF Timer ; Copy W to timer register
00000008,0BA0,down,down DECFSZ Timer ; Decrement timer register
00000009,2808,, GOTO down ; and repeat until zero
0000000A,0008,, RETURN ; Jump back to main program
,,,
,,,
,,,; Start main loop ...........................................
,,,
0000000B,0186,reset,reset CLRF PORTB ; Clear Port B Data
,,,
0000000C,1C08,start,start BTFSS PORTD,Inres ; Test reset button
0000000D,280B,, GOTO reset ; and reset Port B if pressed
0000000E,1888,, BTFSC PORTD,Inrun ; Test run button
0000000F,280C,, GOTO start ; and repeat if n pressed
,,,
00000010,0A86,, INCF PORTB ; Increment output at Port B
00000011,30FF,, MOVLW 0FF ; Delay count literal
,,,; CALL delay ; Jump to subroutine 'delay'
00000012,280C,, GOTO start ; Repeat main loop always
,,,
,,, END ; Terminate source code
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -