no different to tris making pins input or output
![]()
no different to tris making pins input or output
![]()
Warning I'm not a teacher
PIC-AAAHH.pdf
see attached - I changed to LATs as suggested but I still cannot drive the base of my npn with the load in. If I remove the load and turn the FET on - its ok.
I dont get it.
#CONFIG
__config _CONFIG1, _FEXTOSC_OFF & _RSTOSC_HFINT32 & _CLKOUTEN_OFF & _CSWEN_ON & _FCMEN_ON
__config _CONFIG2, _MCLRE_ON & _PWRTE_OFF & _LPBOREN_OFF & _BOREN_ON & _BORV_LO & _ZCD_OFF & _PPS1WAY_OFF & _STVREN_ON
__config _CONFIG3, _WDTCPS_WDTCPS_11 & _WDTE_OFF & _WDTCWS_WDTCWS_6 & _WDTCCS_SC
__config _CONFIG4, _BBSIZE_BB512 & _BBEN_OFF & _SAFEN_OFF & _WRTAPP_OFF & _WRTB_OFF & _WRTC_OFF & _WRTSAF_OFF & _LVP_OFF
__config _CONFIG5, _CP_OFF
#ENDCONFIG
OSCCON1=%00000011
OSCCON2=%00000011
trisa = %11101100
trisc = %11111111
ANSELC = 0
ANSELA = 4
DEFINE OSC 4
FET var LATA.4 ' FET output
IG VAR PORTA.5 ' Ignition input
GREEN VAR LATA.0 ' TIMING LED
RED VAR LATA.1 ' FAULT LED
MAIN:
IF ig = 1 THEN
FET = 1
GREEN = 1
ELSE
FET = 0
GREEN = 0
ENDIF
My dad never liked you...
what is the load ?If I remove the load and turn the FET on - its ok.
what happens with a smaller load ??
sounds like power supply , noise suppression and or wiring layout is inadequate
Warning I'm not a teacher
DC electronic load - it works at 1 amp - any higher it fails (PIC cant drive the base).. no noise - PS can handle 20 amps.. The base of the npn must be sinking too much current for the PIC pin to drive at first. Whats strange is if I disconnect the load the PIC pin drives it ok, add the load and it keeps working. Power cycle PIC and it wont turn on the load again unitl I disconnect load and connect again.
My dad never liked you...
is this your complete code ?
Code:#CONFIG __config _CONFIG1, _FEXTOSC_OFF & _RSTOSC_HFINT32 & _CLKOUTEN_OFF & _CSWEN_ON & _FCMEN_ON __config _CONFIG2, _MCLRE_ON & _PWRTE_OFF & _LPBOREN_OFF & _BOREN_ON & _BORV_LO & _ZCD_OFF & _PPS1WAY_OFF & _STVREN_ON __config _CONFIG3, _WDTCPS_WDTCPS_11 & _WDTE_OFF & _WDTCWS_WDTCWS_6 & _WDTCCS_SC __config _CONFIG4, _BBSIZE_BB512 & _BBEN_OFF & _SAFEN_OFF & _WRTAPP_OFF & _WRTB_OFF & _WRTC_OFF & _WRTSAF_OFF & _LVP_OFF __config _CONFIG5, _CP_OFF #ENDCONFIG OSCCON1=%00000011 OSCCON2=%00000011 trisa = %11101100 trisc = %11111111 ANSELC = 0 ANSELA = 4 DEFINE OSC 4 FET var LATA.4 ' FET output IG VAR PORTA.5 ' Ignition input GREEN VAR LATA.0 ' TIMING LED RED VAR LATA.1 ' FAULT LED MAIN: IF ig = 1 THEN FET = 1 GREEN = 1 ELSE FET = 0 GREEN = 0 ENDIF
Warning I'm not a teacher
yes - thats my test code
My dad never liked you...
with 6k in its collector and a hfe min of 100 the base current required is just a few microamps to drive it into saturationThe base of the npn must be sinking too much current for the PIC pin to drive
the pic will barely know its there
Warning I'm not a teacher
Bookmarks