Blinker for 16F18446 - OSC settings and PORT addressing


+ Reply to Thread
Results 1 to 5 of 5
  1. #1
    Join Date
    Aug 2006
    Location
    SWITZERLAND (french speaking)
    Posts
    921

    Default Blinker for 16F18446 - OSC settings and PORT addressing

    Hi there,

    Did anyone already make a "blinker" for 16F18446? Mine won't work at all

    This device supports PPS (Peripheral Pin Select Module) and I this is new to me. Is there any captcha here?

    I also don't get the oscillator configuration. This device appearently uses PLL as oscillator. But how do I configure it to have kind of 4 or 8 MHz internal oscillator?

    The DS is (again) hard to understand....


    Code:
    '====== FUSES =====================================================================================
    ' PIC 16F18446
    
    #CONFIG
        __config _CONFIG1, _FEXTOSC_HS & _RSTOSC_EXT1X & _CLKOUTEN_OFF & _CSWEN_OFF & _FCMEN_OFF
        __config _CONFIG2, _MCLRE_OFF & _PWRTS_PWRT_64 & _LPBOREN_OFF & _BOREN_SBOREN & _BORV_LO & _ZCDDIS_OFF & _PPS1WAY_OFF & _STVREN_OFF
        __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
    
    ' ====== TEST PROGRAM ==============================================================================
    TEST:
    
        LATB.6 = 1
        pause 500
        LATB.6 = 0
        pause 500
    
    GOTO TEST
    END
    Roger

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


    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 10:54. Reason: nearly forgot osc setup
    Warning I'm not a teacher

  3. #3
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,980


    Did you find this post helpful? Yes | No

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

    Replace // with ' or ;

    Ioannis

  4. #4
    Join Date
    Aug 2006
    Location
    SWITZERLAND (french speaking)
    Posts
    921


    Did you find this post helpful? Yes | No

    Thumbs up Blinker for 16F18446 - OSC settings and PORT addressing

    Guess what: it's blinking now!

    Thanks a lot (again).

    Yes, I had to replace // by '
    Roger

  5. #5
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,980


    Did you find this post helpful? Yes | No

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

    These chips (with PPS registers) need more care to setup correctly. But are very versatile...

    Ioannis

Similar Threads

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

Members who have read this thread : 8

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