Untitled
unknown
plain_text
4 years ago
1.3 kB
10
Indexable
list p=16f84a
#include <p16f84a.inc>
__CONFIG _CP_OFF & _WDT_OFF
w equ 0
f equ 1
Speed_value equ d'5'
Counter equ h'0c'
Shift_cunter equ h'0d'
W_temp equ h'0e'
Status_temp equ h'0f'
Flag_register equ h'10'
#define shift Flag_register,0
org H'0000'
goto start
org H'0004'
goto Int_Service
start bsf STATUS,RP0
movlw B'10010111'
movwf OPTION_REG
bcf STATUS,RP0
clrf PORTB
bsf STATUS,RP0
clrf TRISB
bcf STATUS,RP0
clrf TMR0
movlw B'10100000'
movwf INTCON
clrf Flag_register
movlw Speed_value
movwf Counter
goto main
Int_Service
movwf W_temp
swapf STATUS,w
movwf Status_temp
btfss INTCON,T0IF
goto end_int
TMR0_int
decfsz Counter,f
goto end_int
bsf shift
movlw Speed_value
movwf Counter
end_int
bcf INTCON,T0IF
swapf Status_temp,w
movwf STATUS
swapf W_temp,f
swapf W_temp,w
retfie
main movlw D'8'
movwf Shift_cunter
movlw B'00000001'
movwf PORTB
bcf STATUS,C
shift_again
btfss shift
goto shift_again
rlf PORTB,f
bcf shift
decfsz Shift_cunter,f
goto shift_again
goto main
END
Editor is loading...