imisendo_4036
New Member
hi....need help
this is my source code that is to maintain DC motor speed....
unfortunately, when i run using mplab ide...
its not function....stack pointer doesn't move till de end...
i'm already compile but there is no error....
can anyone who is experience help me...
wuts the problem wif my source code...
n for ur info i'm using pic16f873
this is my code:
;PROGRAM IS TO CONTROL DC MOTOR SPEED
;BY ZULHILMI USING PIC16F873
;*****DECLARATION*****
PROCESSOR 16F873
#include "p16F873.inc"
__CONFIG _HS_OSC & _WDT_OFF & _PWRTE_ON & _LVP_OFF
errorlevel -302
;*****LABEL****
speed equ d'8'
change equ d'1'
led equ h'20'
;****PROGRAM START*****
goto 0
goto init
org 4
goto init
;*****INITIAL PROCESS******
init
;*****PORT****
bsf 03h,5
movlw b'00000001'
movwf 85h
clrf 86h
clrf 87h
bcf 03h,5
;****A/D CONVERTER*****
movlw b'10000101'
movwf 1Fh
bsf 03h,5
movlw b'00001110'
movwf 9Fh
bcf 03h,5
;*****PWM*****
clrf 11h
movlw b'11111111'
movwf 15h
bsf 03h,5
movlw d'254'
movlw 92h
bcf 03h,5
movlw b'00000110'
movwf 12h
movlw b'00001100'
movwf 17h
;*****COMPARE MODE*****
clrf 0Fh
clrf 0Eh
movlw h'61'
movwf 1Ch
movlw h'A8'
movwf 1Bh
movlw b'00000001'
movwf 10h
movlw b'00001011'
movwf 1Dh
;****INTERRUPTION CONTROL******
bsf 03h,5
movlw b'00000001'
movwf 8Dh
bcf 03h,5
movlw b'11000000'
movwf 18Bh
wait
goto $
;*****INTERRUPTION PROCESS*****
int
clrf 0Dh
ad_check
btfsc 1Fh,2
goto ad_check
movlw 1Eh
sublw speed
btfsc 03h,0
goto check1
;****LOW SPEED*****
movlw 15h
addlw change
btfss 03h,0
movwf 15h
goto led_cont
check1
btfsc 03h,2
goto led_cont
;****FAST SPEED******
movlw change
subwf 15h,1
btfsc 03h,0
goto led_cont
clrf 15f
;******LED CONTROL******
led_cont
comf 15h,0
movwf led
movlw b'00010000'
subwf led,0
btfsc 03h,0
goto led1
movlw b'00000000'
goto int_end
led1
movlw b'00100000'
subwf led,0
btfsc 03h,0
goto led2
movlw b'00000001'
goto int_end
led2
movlw b'01000000'
subwf led,0
btfsc 03h,0
goto led3
movlw b'00000011'
goto int_end
led3
movlw b'01100000'
subwf led,0
btfsc 03h,0
goto led4
movlw b'00000111'
goto int_end
led4
movlw b'10000000'
subwf led,0
btfsc 03h,0
goto led5
movlw b'00001111'
goto int_end
led5
movlw b'10100000'
subwf led,0
btfsc 03h,0
goto led6
movlw b'00011111'
goto int_end
led6
movlw b'11000000'
subwf led,0
btfsc 03h,0
goto led7
movlw b'00111111'
goto int_end
led7
movlw b'11100000'
subwf led,0
btfsc 03h,0
goto led8
movlw b'01111111'
goto int_end
led8
movlw b'11111111'
;******END INTERRUPTION******
int_end
movwf 06h
retfile
;**********END OF DC MOTOTR SPEED CONTROLLER*******
END
end
this is my source code that is to maintain DC motor speed....
unfortunately, when i run using mplab ide...
its not function....stack pointer doesn't move till de end...
i'm already compile but there is no error....
can anyone who is experience help me...
wuts the problem wif my source code...
n for ur info i'm using pic16f873
this is my code:
;PROGRAM IS TO CONTROL DC MOTOR SPEED
;BY ZULHILMI USING PIC16F873
;*****DECLARATION*****
PROCESSOR 16F873
#include "p16F873.inc"
__CONFIG _HS_OSC & _WDT_OFF & _PWRTE_ON & _LVP_OFF
errorlevel -302
;*****LABEL****
speed equ d'8'
change equ d'1'
led equ h'20'
;****PROGRAM START*****
goto 0
goto init
org 4
goto init
;*****INITIAL PROCESS******
init
;*****PORT****
bsf 03h,5
movlw b'00000001'
movwf 85h
clrf 86h
clrf 87h
bcf 03h,5
;****A/D CONVERTER*****
movlw b'10000101'
movwf 1Fh
bsf 03h,5
movlw b'00001110'
movwf 9Fh
bcf 03h,5
;*****PWM*****
clrf 11h
movlw b'11111111'
movwf 15h
bsf 03h,5
movlw d'254'
movlw 92h
bcf 03h,5
movlw b'00000110'
movwf 12h
movlw b'00001100'
movwf 17h
;*****COMPARE MODE*****
clrf 0Fh
clrf 0Eh
movlw h'61'
movwf 1Ch
movlw h'A8'
movwf 1Bh
movlw b'00000001'
movwf 10h
movlw b'00001011'
movwf 1Dh
;****INTERRUPTION CONTROL******
bsf 03h,5
movlw b'00000001'
movwf 8Dh
bcf 03h,5
movlw b'11000000'
movwf 18Bh
wait
goto $
;*****INTERRUPTION PROCESS*****
int
clrf 0Dh
ad_check
btfsc 1Fh,2
goto ad_check
movlw 1Eh
sublw speed
btfsc 03h,0
goto check1
;****LOW SPEED*****
movlw 15h
addlw change
btfss 03h,0
movwf 15h
goto led_cont
check1
btfsc 03h,2
goto led_cont
;****FAST SPEED******
movlw change
subwf 15h,1
btfsc 03h,0
goto led_cont
clrf 15f
;******LED CONTROL******
led_cont
comf 15h,0
movwf led
movlw b'00010000'
subwf led,0
btfsc 03h,0
goto led1
movlw b'00000000'
goto int_end
led1
movlw b'00100000'
subwf led,0
btfsc 03h,0
goto led2
movlw b'00000001'
goto int_end
led2
movlw b'01000000'
subwf led,0
btfsc 03h,0
goto led3
movlw b'00000011'
goto int_end
led3
movlw b'01100000'
subwf led,0
btfsc 03h,0
goto led4
movlw b'00000111'
goto int_end
led4
movlw b'10000000'
subwf led,0
btfsc 03h,0
goto led5
movlw b'00001111'
goto int_end
led5
movlw b'10100000'
subwf led,0
btfsc 03h,0
goto led6
movlw b'00011111'
goto int_end
led6
movlw b'11000000'
subwf led,0
btfsc 03h,0
goto led7
movlw b'00111111'
goto int_end
led7
movlw b'11100000'
subwf led,0
btfsc 03h,0
goto led8
movlw b'01111111'
goto int_end
led8
movlw b'11111111'
;******END INTERRUPTION******
int_end
movwf 06h
retfile
;**********END OF DC MOTOTR SPEED CONTROLLER*******
END
end