18F Config fuses


Closed Thread
Results 1 to 21 of 21

Hybrid View

  1. #1

    Default 18F Config fuses

    Hi Everyone

    I am migrating a project from a 16F877A to an 18F452 and need to set the 18F config fuses
    I'm using MCS/PBP2.46/Picbasic compiler
    I have all the @ DEVICE config fuses for 16F devices, but where can I get a list of the config fuses for the 18F452? Nothing in the PBP manual.
    Melanie's helpful post on setting config fuses says to go to the INC folder in the PBP folder, and your device should be listed there with the answers
    Trouble is, no 18F devices are listed in the INC file, only 10/12/14/16/17 series devices.

    Setting the fuses in the programmer every time I compile is a pain!!

    Any advice will be appreciated

    Angus Anderson

  2. #2


    Did you find this post helpful? Yes | No

    Default

    Check the file P18F452.INC in the MPASM Suite folder. At the bottom is the configuration fuse settings.

    The are the ones that I am currently using. For more description of the function refer to the data sheet under the section "Special Feature of the CPU". There it list all the fuses and there functions.

    Code:
    ;************************ 18F452 Configuration Fuses ***************************
    
    @ __CONFIG _CONFIG1H, _OSCS_OFF_1H & _HSPLL_OSC_1H
    ; Oscillator Switchover Disabled
    ; Oscillator Type HS PLL    
     
    @ __CONFIG _CONFIG2L, _BOR_ON_2L & _PWRT_ON_2L & _BORV_45_2L
    ; Brown-Out Reset Enabled
    ; Power-Up Timer Enabled
    ; Brown-Out Reset Voltage 4.5V
    
    @ __CONFIG _CONFIG2H, _WDT_ON_2H 
    ; Watch Dog Timer Enabled
    
    @ __CONFIG _CONFIG4L, _STVR_ON_4L & _LVP_OFF_4L & _DEBUG_OFF_4L
    ; Stack Over/Underflow Reset Enabled
    ; Low Voltage ICSP Programming Disabled
    ; Background Debugger Disabled
    
    ;*******************************************************************************

  3. #3
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    I'll also suggest you to read Melanie's thread again, at least from POST 1 to 5.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  4. #4


    Did you find this post helpful? Yes | No

    Default

    Thanks CCKid, and Steve for your replies.

    I do understand the way that 18F configs work (studied the datasheet for hours!), but my problem is to try and get the syntax for the PM assembler config statements for the 18F. All the very clear examples (thanks chaps) are examples using the syntax for the MPASM assembler. Are there a set of 18F config directives for the PM assembler (@ device blah blah)? What I am sensing here is that most of you 18F users are using MPASM and if so, I will have to migrate.

    Lets chuck a further thought into the pot. Is there a way in PBP that I can directly write to 18F config memory locations 30000 to 3000x the same way that I can write to EEPROM i.e without going to an assembler TBLREAD/WRITE routine to do it? That way would solve my problem instantly, 'cos I can just include it as a program statement or statements

    Thanks guys

    Angus Anderson

  5. #5


    Did you find this post helpful? Yes | No

    Default

    I may be mistaken but I believe you have to use the MPASM assembler with the 18F series of chips. What is the problem with using MPASM? I just installed it and told MCSP to use it for my assembling and it works perfect.

  6. #6
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    As CocaColaKid said... 18F's MUST use the MPASM Assembler.

    Here is an EXAMPLE (for PIC18F2420) of the instructions that can be included at the start of your PBP program...

    Code:
    	'
    	'	PIC Defines for PIC18F2420
    	'	==========================
    
    	@ __CONFIG    _CONFIG1H, _IESO_OFF_1H & _FCMEN_OFF_1H & _OSC_INTIO67_1H
    			' Oscillator Switch-over Disabled
    			' Fail-Safe clock Monitor Disabled
    			' _OSC_INTIO67_1H Set for Internal Oscillator RA6 & RA7 Enabled
    	@ __CONFIG    _CONFIG2L, _BOREN_ON_2L & _PWRT_ON_2L & _BORV_0_2L
    			' Brown-Out Reset Enabled
    			' Power-On Timer Enabled
    			' Brown-Out Trip set to 4.2v
            @ __CONFIG    _CONFIG2H, _WDT_ON_2H & _WDTPS_128_2H
    			' WatchDog is ON
    			' Watchdog Postscaler set to 1:128
    	@ __CONFIG    _CONFIG3H, _MCLRE_OFF_3H & _PBADEN_OFF_3H & _CCP2MX_PORTC_3H
    			' MCLR is OFF (internal)
    			' PortB 4:0 is digital on Reset
    			' CCP2 is Multiplexed with PortC.1
            @ __CONFIG    _CONFIG4L, _STVREN_ON_4L & _XINST_OFF_4L & _LVP_OFF_4L & _DEBUG_OFF_4L
    			' Stack Under/Overflow will Reset System
    			' Enhanced CPU Addressing Disabled
    			' Low-Voltage Programming is OFF
    			' DEBUG is Disabled
    	@ __CONFIG    _CONFIG5L, _CP1_ON_5L & _CP0_ON_5L
    			' All Code Protect
            @ __CONFIG    _CONFIG5H, _CPB_ON_5H & _CPD_ON_5H
    			' EEPROM is Code Protected
    			' Boot Block code is Code Protected
    Here is an extract from the P18F2420.INC file in the MPLAB MPASM Suite subdirectory... note how (1) The ones needed have been copied from the INC file and inserted into the CONFIG statement.... and (2) for detailed explaination of each feature, refer to the DATASHEET - but I mustn't say that because I'll get flamed, so instead direct your queries to various members of the forum who'll read the Datasheet for you...

    Code:
    ;----- CONFIG1H Options --------------------------------------------------
    _OSC_LP_1H           EQU  H'F0'    ; LP oscillator
    _OSC_XT_1H           EQU  H'F1'    ; XT oscillator
    _OSC_HS_1H           EQU  H'F2'    ; HS oscillator
    _OSC_RC_1H           EQU  H'F3'    ; External RC oscillator, CLKO function on RA6
    _OSC_EC_1H           EQU  H'F4'    ; EC oscillator, CLKO function on RA6
    _OSC_ECIO6_1H        EQU  H'F5'    ; EC oscillator, port function on RA6
    _OSC_HSPLL_1H        EQU  H'F6'    ; HS oscillator, PLL enabled (Clock Frequency = 4 x FOSC1)
    _OSC_RCIO6_1H        EQU  H'F7'    ; External RC oscillator, port function on RA6
    _OSC_INTIO67_1H      EQU  H'F8'    ; Internal oscillator block, port function on RA6 and RA7
    _OSC_INTIO7_1H       EQU  H'F9'    ; Internal oscillator block, CLKO function on RA6, port function on RA7
    
    _FCMEN_OFF_1H        EQU  H'BF'    ; Fail-Safe Clock Monitor disabled
    _FCMEN_ON_1H         EQU  H'FF'    ; Fail-Safe Clock Monitor enabled
    
    _IESO_OFF_1H         EQU  H'7F'    ; Oscillator Switchover mode disabled
    _IESO_ON_1H          EQU  H'FF'    ; Oscillator Switchover mode enabled
    
    ;----- CONFIG2L Options --------------------------------------------------
    _PWRT_ON_2L          EQU  H'FE'    ; PWRT enabled
    _PWRT_OFF_2L         EQU  H'FF'    ; PWRT disabled
    
    _BOREN_OFF_2L        EQU  H'F9'    ; Brown-out Reset disabled in hardware and software
    _BOREN_ON_2L         EQU  H'FB'    ; Brown-out Reset enabled and controlled by software (SBOREN is enabled)
    _BOREN_NOSLP_2L      EQU  H'FD'    ; Brown-out Reset enabled in hardware only and disabled in Sleep mode (SBOREN is disabled)
    _BOREN_SBORDIS_2L    EQU  H'FF'    ; Brown-out Reset enabled in hardware only (SBOREN is disabled)
    
    _BORV_0_2L           EQU  H'E7'    ; Maximum setting
    _BORV_1_2L           EQU  H'EF'    ; 
    _BORV_2_2L           EQU  H'F7'    ; 
    _BORV_3_2L           EQU  H'FF'    ; Minimum setting
    
    ;----- CONFIG2H Options --------------------------------------------------
    _WDT_OFF_2H          EQU  H'FE'    ; WDT disabled (control is placed on the SWDTEN bit)
    _WDT_ON_2H           EQU  H'FF'    ; WDT enabled
    
    _WDTPS_1_2H          EQU  H'E1'    ; 1:1
    _WDTPS_2_2H          EQU  H'E3'    ; 1:2
    _WDTPS_4_2H          EQU  H'E5'    ; 1:4
    _WDTPS_8_2H          EQU  H'E7'    ; 1:8
    _WDTPS_16_2H         EQU  H'E9'    ; 1:16
    _WDTPS_32_2H         EQU  H'EB'    ; 1:32
    _WDTPS_64_2H         EQU  H'ED'    ; 1:64
    _WDTPS_128_2H        EQU  H'EF'    ; 1:128
    _WDTPS_256_2H        EQU  H'F1'    ; 1:256
    _WDTPS_512_2H        EQU  H'F3'    ; 1:512
    _WDTPS_1024_2H       EQU  H'F5'    ; 1:1024
    _WDTPS_2048_2H       EQU  H'F7'    ; 1:2048
    _WDTPS_4096_2H       EQU  H'F9'    ; 1:4096
    _WDTPS_8192_2H       EQU  H'FB'    ; 1:8192
    _WDTPS_16384_2H      EQU  H'FD'    ; 1:16384
    _WDTPS_32768_2H      EQU  H'FF'    ; 1:32768
    
    ;----- CONFIG3H Options --------------------------------------------------
    etc etc etc
    You will need to modify the 18F2420.INC file located in your PBP directory to something like this... (remembering to backup the original)...
    Code:
    ;****************************************************************
    ;*  18F2420.INC                                                 *
    ;*                                                              *
    ;*  By        : Leonard Zerman, Jeff Schmoyer                   *
    ;*  Notice    : Copyright (c) 2004 microEngineering Labs, Inc.  *
    ;*              All Rights Reserved                             *
    ;*  Date      : 12/31/04                                        *
    ;*  Version   : 2.46                                            *
    ;*  Notes     : Butchered by Melanie                            *
    ;****************************************************************
            NOLIST
        ifdef PM_USED
            LIST
            "Error: PM does not support this device.  Use MPASM."
            NOLIST
        else
            LIST
            LIST p = 18F2420, r = dec, w = -311, f = inhx32
            INCLUDE "P18F2420.INC"   ; MPASM  Header
    
            NOLIST
        endif
            LIST
    EEPROM_START	EQU	0F00000h
    BLOCK_SIZE	EQU	8
    This is because the MPASM Assembler cannot handle CONFIG conflicts....

    Finally, to make it all compile (and remembering to ensure you have a PATH embedded pointing to your MPASM directory), you can compile with a command line like...

    PBPW -p18F2420 MyProgram -ampasmwin -v

    Hey presto... it'll compile and embed all your selected CONFIG directives into the resultant HEX file (and as a bonus MPASM displays a lovely green progress bar that just makes you feel all warm and fuzzy inside).

    You may get some warning messages (they're just Warnings and NOT Errors) from MPASM that the CONFIG statements have been depricated, but a search on this forum will reveal how to suppress those.

Similar Threads

  1. A/D conversion with PIC18F67J50
    By ScaleRobotics in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 8th May 2009, 01:48
  2. 18F4550 Bootloader enter via eeprom setting
    By bradb in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 22nd November 2008, 23:51
  3. Error 0X0000008E when connecting a 18F2550 USB HID
    By FranciscoMartin in forum USB
    Replies: 8
    Last Post: - 16th October 2008, 17:20
  4. PortE problems (PIC18F4455)
    By RubenR in forum mel PIC BASIC Pro
    Replies: 15
    Last Post: - 12th July 2006, 15:26
  5. Installation sequence
    By Demon in forum General
    Replies: 23
    Last Post: - 11th July 2006, 03:56

Members who have read this thread : 0

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