Professional Documents
Culture Documents
;
'__CONFIG' directive is used to embed configuration data within .asm file.
;
The lables following the directive are located in the respective .inc file.
;
See respective data sheet for additional information on configuration
word.
VARIABLE DEFINITIONS
w_temp
status_temp
EQU
EQU
mark30
post80
sec5
0x0C
0x0D
equ
equ
equ
0x10
0x11
0x12
Start Place
ORG
goto
ORG
0x000
start
0x004
;**********************************************************************
;SubRoutine
Init
CLRF STATUS
; Bank0
CLRF PORTA
; Initialize PORTB by clearing
output
CLRF PORTB
; data latches
BSF STATUS, RP0
; Select Bank1
MOVLW
b'00000'
; Select PortA Ports
MOVWF
TRISA
;
MOVLW
b'00000000'
; Select PortB Ports
MOVWF
TRISB
;
BCF STATUS, RP0
; Bank0
CLRWDT
; Clear WDT and prescaler
BSF STATUS, RP0
; Bank1
MOVLW
b'00000111'
; Select TMR0, new prescale
MOVWF
OPTION_REG
; value and clock source
BCF STATUS, RP0
; Bank0
movlw
movwf
d'30'
mark30
; sets up marker
;
movlw
d'80'
movwf
post80
movlw
movwf
d'5'
sec5
;
; sets up five second counter
;
Init
main movfw
subwf
number in
mark30
TMR0, w
in the working
; register (and leaving
TMR0 unchanged)
btfss
the result
STATUS, Z
instruction
goto
main
'Loop'
;***
movlw
into the working
addwf
decfsz
d'30'
mark30, f
post80, f
zero
goto
main
'Loop'
; one second has now passed
;***
movlw
movwf
d'80'
post80
; resets postscaler
;
;***
comf
PORTA, f
decfsz
goto
sec5, f
main
;***
movlw
movwf
goto
END
d'5'
sec5
main