Leaves the mainloop???


Closed Thread
Results 1 to 40 of 46

Hybrid View

  1. #1
    Join Date
    Apr 2016
    Location
    Plainfield, Illinois
    Posts
    73


    Did you find this post helpful? Yes | No

    Default Re: Leaves the mainloop???

    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...

  2. #2
    Join Date
    May 2013
    Location
    australia
    Posts
    2,631


    Did you find this post helpful? Yes | No

    Default Re: Leaves the mainloop???

    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

  3. #3
    Join Date
    Apr 2016
    Location
    Plainfield, Illinois
    Posts
    73


    Did you find this post helpful? Yes | No

    Default Re: Leaves the mainloop???

    yes - thats my test code
    My dad never liked you...

  4. #4
    Join Date
    May 2013
    Location
    australia
    Posts
    2,631


    Did you find this post helpful? Yes | No

    Default Re: Leaves the mainloop???

    The base of the npn must be sinking too much current for the PIC pin to drive
    with 6k in its collector and a hfe min of 100 the base current required is just a few microamps to drive it into saturation
    the pic will barely know its there
    Warning I'm not a teacher

Similar Threads

  1. Time taken to do mainloop
    By Gerald in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 29th March 2023, 14:16
  2. Outside the Mainloop
    By pescador in forum General
    Replies: 10
    Last Post: - 26th April 2016, 17:34

Members who have read this thread : 2

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts