moschino891129
Junior Member level 1
Is it posible the microcontroler to be burned out ? and if it is will the programer indicate this ? I use PICkit ver 2.55 programer. Is there some way to check the condition of crystal and condensers ?
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Hi,
V 2.55 thats rather old, you want to download the latest version 2.61, allows you to program and debug many more chips.
You can also program direct from MPLAB, use the Programmer Menu.
The programmer can read,erase and write to the memory arrays of the chip, doubt it could help test anything else.
You want to start with your +5v supply, is that good ?, if not use 4.5v of batteries for a test.
Disconnect your resistors to the transistors, program up a simple led flasher to test the chip and see if that works.
If ok then transfer the led to the ports used by the resistors and see if they work ok.
If ok, suspect the transistors, do they get hot, are they on a heatsink ?
Any idea how much current your motor takes at full speed / 12v.
list p=16F84A
#include <p16F84A.inc>
__CONFIG _CP_OFF & _WDT_OFF & _PWRTE_ON & _XT_OSC
w EQU 0
f EQU 1
Counter EQU H'0C'
c equ 0
portb equ 0x06 ; port b equate
duty equ 0x0c ; length of duty cycle
temp equ 0x0d ; length of duty cycle
cou set d'100'
ORG H'0000'
goto start
start bsf STATUS,RP0
movlw B'11010111'
movwf OPTION_REG
bcf STATUS,RP0
clrf PORTB
bsf STATUS,RP0
movlw B'11111000'
movwf TRISB
bcf STATUS,RP0
goto main
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;deley for the pause between subroutines
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
WaitP movlw D'30'
movwf Counter
clrf TMR0
againP bcf INTCON,T0IF
loopP btfss INTCON,T0IF
goto loopP
decfsz Counter,f
goto againP
return
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;delay for the time of Action on pwm100b and pwm100f
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
WaitA movlw D'70'
movwf Counter
clrf TMR0
againA bcf INTCON,T0IF
loopA btfss INTCON,T0IF
goto loopA
decfsz Counter,f
goto againA
return
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;pwm 50% forward
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
pwm50f movlw d'0'
movwf portb
movlw d'90' ; Duty cycle length
movwf duty
movf duty,w
movwf temp
bsf portb,0
bsf portb,1
pwma50f nop
nop
nop
decfsz temp
goto pwma50f
movlw d'255'
movwf temp
movf duty,w
subwf temp,f
bcf portb,0
bcf portb,1
pwmb50f nop
nop
nop
decfsz temp
goto pwmb50f
bcf INTCON,T0IF
btfss INTCON,T0IF
goto pwm50f
decfsz cou
clrf TMR0
return
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;pwm 50% backward
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
pwm50b movlw d'0'
movwf portb
movlw d'90' ; Duty cycle length
movwf duty
movf duty,w
movwf temp
bsf portb,0
bsf portb,1
bsf portb,2
pwma50b nop
nop
nop
decfsz temp
goto pwma50b
movlw d'255'
movwf temp
movf duty,w
subwf temp,f
bcf portb,0
bcf portb,1
bcf portb,2
pwmb50b nop
nop
nop
decfsz temp
goto pwmb50b
bcf INTCON,T0IF
btfss INTCON,T0IF
goto pwm50b
decfsz cou
clrf TMR0
return
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;pwm 100% forward
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
pwm100f bsf portb,0
bsf portb,1
call WaitA
bcf portb,0
bcf portb,1
return
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;pwm 100% backward
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
pwm100b bsf portb,0
bsf portb,1
bsf portb,2
call WaitA
bcf portb,0
bcf portb,1
bcf portb,2
return
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
main call pwm100f
call WaitP
call pwm50f
call WaitP
call pwm100b
call WaitP
call pwm50b
call WaitP
goto main
END
list p=16F84A
#include <p16F84A.inc>
__CONFIG _CP_OFF & _WDT_OFF & _PWRTE_ON & _XT_OSC
Counter equ 0x0c
duty equ 0x0d ; length of duty cycle
temp equ 0x0e ; length of duty cycle
cou equ 0x0f
ORG H'0000'
goto start
start movlw d'100'
movwf cou
bsf STATUS,RP0
movlw B'11010111'
pwmb50f nop
nop
nop
decfsz temp
goto pwmb50f
bcf INTCON,T0IF ;; YOU CLEAR THE TIMER FLAG HERE
btfss INTCON,T0IF ;;NEXT INSTRUCTION YOU TEST IF ITS SET, IT WILL NOT BE , SO IT GOES BACK TO pwm50f
goto pwm50f
decfsz cou
clrf TMR0
return
list p=16F84A
#include <p16F84A.inc>
__CONFIG _CP_OFF & _WDT_OFF & _PWRTE_ON & _XT_OSC
w EQU 0
f EQU 1
portb equ 0x06 ; port b equate
Counter EQU 0x0c
duty equ 0x0d ; length of duty cycle
temp equ 0x0e ; length of duty cycle
cou equ 0x0f
ORG H'0000'
goto start
start movlw d'100'
movwf cou
bsf STATUS,RP0
movlw B'11010111'
movwf OPTION_REG
bcf STATUS,RP0
clrf PORTB
bsf STATUS,RP0
movlw B'11111000'
movwf TRISB
bcf STATUS,RP0
goto main
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;deley for the pause between subroutines
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
WaitP movlw D'50'
movwf Counter
clrf TMR0
againP bcf INTCON,T0IF
loopP btfss INTCON,T0IF
goto loopP
decfsz Counter,f
goto againP
return
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;delay for the time of Action on pwm100b and pwm100f
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
WaitA movlw D'70'
movwf Counter
clrf TMR0
againA bcf INTCON,T0IF
loopA btfss INTCON,T0IF
goto loopA
decfsz Counter,f
goto againA
return
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;pwm 50% speed
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
pwm50 movlw d'0'
movwf portb
movlw d'90'
movwf duty
movf duty,w
movwf temp
bsf portb,0
bsf portb,1
pwma50 nop
nop
nop
decfsz temp
goto pwma50
movlw d'255'
movwf temp
movf duty,w
subwf temp,f
bcf portb,0
bcf portb,1
pwmb50 nop
nop
nop
decfsz temp ;temp = temp-1 . temp=0 ?
goto pwmb50 ;НЕ - изпъни отново
;ДА - прескочи "goto pwmb50f"
btfss INTCON,T0IF ;бит T0IF=1???
goto pwm50 ;НЕ - върни се в началото на подпрограмата
decfsz cou ;ДА - намали cou с 1. cou=0 ?
goto t0clr ;НЕ - върни се в началото на подпрограмата
return ;ДА - върни се към главната програма
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;t0clr - нулиране на бит T0IF на TMR0
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
t0clr bcf INTCON,T0IF
goto pwm50
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;pwm 100% forward
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
pwm100f bsf portb,0
bsf portb,1
call WaitA
bcf portb,0
bcf portb,1
return
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;pwm 100% backward
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
pwm100b bsf portb,0
bsf portb,1
bsf portb,2
call WaitA
bcf portb,0
bcf portb,1
bcf portb,2
return
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
main call pwm100f
call WaitP
movlw d'100'
movwf cou
clrf TMR0
bcf INTCON,T0IF
call pwm50
call WaitP
call pwm100b
call WaitP
movlw d'100'
movwf cou
clrf TMR0
bcf INTCON,T0IF
bsf portb,2
call pwm50
bcf portb,2
call WaitP
goto main
END