CONFIG issues with 18F26K22


Closed Thread
Results 1 to 13 of 13

Hybrid View

  1. #1


    Did you find this post helpful? Yes | No

    Default Re: CONFIG issues with 18F26K22

    FWIW if you want to use your Pickit2, heres a modified PK2DeviceFile which can programme 18F26K22 and a couple of simple apps for manipulating the dat file.
    Attached Files Attached Files
    Last edited by towlerg; - 5th April 2018 at 23:04.
    George

  2. #2
    Join Date
    May 2009
    Location
    Saint-Quentin-en-Yvelines, FRANCE
    Posts
    82


    Did you find this post helpful? Yes | No

    Default Re: CONFIG issues with 18F26K22

    Many thanks tumbleweed, it works now !

    I can't understand why Microchip make such complex thinks sometimes
    "Keep it simple" should be the rule !

    George, would your mods for the PicKit2 provide also the debug capability or only programming ?

    Best regards
    MikeBZH

  3. #3


    Did you find this post helpful? Yes | No

    Default Re: CONFIG issues with 18F26K22

    @Mike. No, just stand alone PK2cmd.exe and Pickit2v2.exe.

    For what it's worth the config I use (in Proton but easily transposed)
    Code:
    	' internal clock 16MHz with 4xPLL = 64MHz
      $if _device = _18F26K22
      	Config_Start
      	  FOSC = INTIO67	   ; Internal oscillator block
      	  PLLCFG = On	       ; Oscillator multiplied by 4
      	  PRICLKEN = On	     ; Primary clock enabled
      	  FCMEN = OFF	       ; Fail-Safe Clock Monitor disabled
      	  IESO = OFF	       ; Oscillator Switchover mode disabled
      	  PWRTEN = On	       ; Power up timer enabled
      	  BOREN = On	       ; Brown-out Reset enabled and controlled by software (SBOREN is enabled)
      	  BORV = 285	       ; VBOR set to 2.85 V nominal
      	  WDTEN = OFF	       ; Watch dog timer is always disabled. SWDTEN has no effect.
      	  WDTPS = 32768	     ; 1:32768
      	  CCP2MX = PORTC1	   ; CCP2 input/output is multiplexed with RC1
      	  PBADEN = OFF	     ; PORTB<5:0> pins are configured as digital I/O on Reset
      	  CCP3MX = PORTB5	   ; P3A/CCP3 input/output is multiplexed with RB5
      	  HFOFST = On	       ; HFINTOSC output and ready status are not delayed by the oscillator stable status
      	  T3CMX = PORTC0	   ; T3CKI is on RC0
      	  P2BMX = PORTB5	   ; P2B is on RB5
      	  MCLRE = INTMCLR	   ; RE3 input pin enabled; MCLR disabled
      	  STVREN = On	       ; Stack full/underflow will cause Reset
      	  LVP = OFF	         ; Single-Supply ICSP disabled
      	  XINST = OFF	       ; Instruction set extension and Indexed Addressing mode disabled (Legacy mode)
      	  Debug = OFF	       ; Disabled
      	  Cp0 = OFF	         ; Block 0 (000800-003FFFh) not code-protected
      	  CP1 = OFF	         ; Block 1 (004000-007FFFh) not code-protected
      	  CP2 = OFF	         ; Block 2 (008000-00BFFFh) not code-protected
      	  CP3 = OFF	         ; Block 3 (00C000-00FFFFh) not code-protected
      	  CPB = OFF	         ; Boot block (000000-0007FFh) not code-protected
      	  CPD = OFF	         ; Data EEPROM not code-protected
      	  WRT0 = OFF	       ; Block 0 (000800-003FFFh) not write-protected
      	  WRT1 = OFF	       ; Block 1 (004000-007FFFh) not write-protected
      	  WRT2 = OFF	       ; Block 2 (008000-00BFFFh) not write-protected
      	  WRT3 = OFF	       ; Block 3 (00C000-00FFFFh) not write-protected
      	  WRTC = OFF	       ; Configuration registers (300000-3000FFh) not write-protected
      	  WRTB = OFF	       ; Boot Block (000000-0007FFh) not write-protected
      	  WRTD = OFF	       ; Data EEPROM not write-protected
      	  EBTR0 = OFF	       ; Block 0 (000800-003FFFh) not protected from table reads executed in other blocks
      	  EBTR1 = OFF	       ; Block 1 (004000-007FFFh) not protected from table reads executed in other blocks
      	  EBTR2 = OFF	       ; Block 2 (008000-00BFFFh) not protected from table reads executed in other blocks
      	  EBTR3 = OFF	       ; Block 3 (00C000-00FFFFh) not protected from table reads executed in other blocks
      	  EBTRB = OFF	       ; Boot Block (000000-0007FFh) not protected from table reads executed in other blocks
      	Config_End
      $endif
    George

  4. #4
    Join Date
    Mar 2003
    Location
    Commerce Michigan USA
    Posts
    1,166


    Did you find this post helpful? Yes | No

    Default Re: CONFIG issues with 18F26K22

    MikeBZH, Here is the config I use for almost all of my 26K22 projects: 64Mhz internal OSC.

    #CONFIG
    ;----- CONFIG1H Options --------------------------------------------------
    __config _CONFIG1H, _FOSC_INTIO7_1H & _PLLCFG_ON_1H & _PRICLKEN_ON_1H & _FCMEN_ON_1H & _IESO_OFF_1H
    ;----- CONFIG2L Options --------------------------------------------------
    __config _CONFIG2L, _PWRTEN_ON_2L & _BOREN_ON_2L & _BORV_190_2L
    ;----- CONFIG2H Options --------------------------------------------------
    __config _CONFIG2H, _WDTEN_OFF_2H & _WDTPS_32768_2H
    ;----- CONFIG3H Options --------------------------------------------------
    __config _CONFIG3H, _CCP2MX_PORTB3_3H & _PBADEN_OFF_3H & _HFOFST_OFF_3H & _T3CMX_PORTB5_3H & _MCLRE_EXTMCLR_3H
    ;----- CONFIG4L Options --------------------------------------------------
    __config _CONFIG4L, _STVREN_ON_4L & _LVP_OFF_4L & _XINST_OFF_4L & _DEBUG_OFF_4L
    #ENDCONFIG
    Dave Purola,
    N8NTA
    EN82fn

  5. #5
    Join Date
    Dec 2010
    Posts
    409


    Did you find this post helpful? Yes | No

    Default Re: CONFIG issues with 18F26K22

    If you are really using a crystal then you need FOSC = LP (or the correct setting for a low power crystal with your device.)
    Your file is set for a medium power high speed resonator

  6. #6
    Join Date
    Aug 2011
    Posts
    460


    Did you find this post helpful? Yes | No

    Default Re: CONFIG issues with 18F26K22

    LP, XT, and HS settings are all for use with crystals.
    See section 2.5.3 in the datasheet.

  7. #7
    Join Date
    Dec 2010
    Posts
    409


    Did you find this post helpful? Yes | No

    Default Re: CONFIG issues with 18F26K22

    Tumbleweed - You're right - I should have looked it up instead of going by memory.

  8. #8
    Join Date
    May 2009
    Location
    Saint-Quentin-en-Yvelines, FRANCE
    Posts
    82


    Did you find this post helpful? Yes | No

    Default Re: CONFIG issues with 18F26K22

    Thank you Dave,

    I need some frequency accuracy. This is why I don't use the internal oscillator but an external xtal and in that case the CONFIG is a little bit different.

    But this issue is fixed now.

    I am now faced with reading the port A digital inputs. Quite simple question but for an unknown reason it behaves differently than with the 18F2685.

    73
    MikeBZH (F8DFN)

  9. #9
    Join Date
    Aug 2011
    Posts
    460


    Did you find this post helpful? Yes | No

    Default Re: CONFIG issues with 18F26K22

    I am now faced with reading the port A digital inputs
    Both devices have analog functions on portA but the function is selected differently.
    On the 2685 you use the ADCON1 register, while with the 26K22 it's set with the ANSELA register.

  10. #10
    Join Date
    Mar 2003
    Location
    Commerce Michigan USA
    Posts
    1,166


    Did you find this post helpful? Yes | No

    Default Re: CONFIG issues with 18F26K22

    Mike, here is the setup for one of my projects:

    ANSELA = %00101111 'PORTS A5,A3,A2,A1,A0 ALALOG, A7,A6,A4 DIGITAL
    ANSELB = %00100000 'PORTS B7,B6,B4,B3,B2,B1,B0 DIGITAL BUFFERED, B5 ANALOG
    ANSELC = %00000000 'PORTS C7,C6,C5,C4,C3,C2,C1,C0 DIGITAL BUFFERED

    Hope this helps...
    Dave Purola,
    N8NTA
    EN82fn

Similar Threads

  1. DT_INTS and 18F26k22
    By Mike2545 in forum mel PIC BASIC Pro
    Replies: 14
    Last Post: - 9th September 2017, 17:08
  2. 12F1840 config issues
    By enigma in forum PBP3
    Replies: 13
    Last Post: - 15th February 2015, 08:49
  3. 18F26K22 slow startup
    By Tobias in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 7th January 2014, 23:10
  4. Compiling for 18F26K22 - Does anyone have a solution for me?
    By Balachandar in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 28th August 2012, 13:49
  5. 12c508a Device Config. And Burning Issues
    By sayzer in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 29th March 2006, 17:50

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