Blinker for 16F18446 - OSC settings and PORT addressing


Results 1 to 5 of 5

Threaded View

  1. #2
    Join Date
    May 2013
    Location
    australia
    Posts
    2,645


    Did you find this post helpful? Yes | No

    Default Re: Blinker for 16F18446 - OSC settings and PORT addressing

    you won't get far blinking pin latb.6 when its defined as an analog input

    i assume you are not using a xtal osc

    this will do it ,i think [ untested]

    Code:
    '====== FUSES =====================================================================================
    ' PIC 16F18446
    
    
    
    
    #CONFIG
        __config _CONFIG1, _FEXTOSC_OFF & _RSTOSC_HFINT1 & _CLKOUTEN_OFF & _CSWEN_ON & _FCMEN_ON
        __config _CONFIG2, _MCLRE_ON & _PWRTS_PWRT_64 & _LPBOREN_OFF & _BOREN_SBOREN & _BORV_LO & _ZCDDIS_OFF & _PPS1WAY_OFF & _STVREN_ON
        __config _CONFIG3, _WDTCPS_WDTCPS_31 & _WDTE_SWDTEN & _WDTCWS_WDTCWS_7 & _WDTCCS_LFINTOSC
        __config _CONFIG4, _BBSIZE_BB512 & _BBEN_OFF & _SAFEN_OFF & _WRTAPP_OFF & _WRTB_OFF & _WRTC_OFF & _WRTD_OFF & _WRTSAF_OFF & _LVP_OFF
        __config _CONFIG5, _CP_OFF
    
    
    #ENDCONFIG
    
    
    ' ====== DEFINES ===================================================================================
    DEFINE OSC 4
        ANSELB = $B0;
        TRISB = $B0;
       OSCCON1 = $60;
        // CSWHOLD may proceed; SOSCPWR Low power; 
        OSCCON3 = 0
        // MFOEN disabled; LFOEN disabled; ADOEN disabled; SOSCEN disabled; EXTOEN disabled; HFOEN disabled; 
        OSCEN = 0
        // HFFRQ 4_MHz; 
        OSCFRQ = 2;
        // HFTUN 0; 
        OSCTUNE = 0
    
    
    
    
    ' ====== TEST PROGRAM ==============================================================================
    TEST:
    
    
        LATB.6 = 1
        pause 500
        LATB.6 = 0
        pause 500
    
    
    GOTO TEST
    END
    for osc=8mhz
    // HFFRQ 8_MHz; OSCFRQ = 3;
    Last edited by richard; - 10th February 2024 at 09:54. Reason: nearly forgot osc setup
    Warning I'm not a teacher

Similar Threads

  1. Replies: 4
    Last Post: - 13th January 2021, 00:43
  2. Port settings - 18F4620
    By Scampy in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 20th November 2015, 06:17
  3. Port Addressing Issue
    By CocaColaKid in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 3rd November 2005, 19:15
  4. 18F2525 Int Osc settings?
    By Tom Gonser in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 26th March 2005, 22:44

Members who have read this thread : 1

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