Presetting Configuration Fuses (PIC Defines) into your Program


+ Reply to Thread
Results 1 to 40 of 83

Hybrid View

  1. #1
    Join Date
    Feb 2008
    Location
    Michigan, USA
    Posts
    231


    Did you find this post helpful? Yes | No

    Default Subtle differences in config

    This doesn't directly apply to your situation this time, but I did run into a sneaky change the other day that took me a while to notice..
    I was trying to change the oscillator config on a 18F1320. I had been recently using 18F1330s and just assumed they would be the same since they were so close family wise. Bad assumption. Here are the two together.
    Code:
    ;****************************************************************
    ;*  18F1330.INC                                                 *
    ;*                                                              *
    ;*  By        : Leonard Zerman, Jeff Schmoyer                   *
    ;*  Notice    : Copyright (c) 2006 microEngineering Labs, Inc.  *
    ;*              All Rights Reserved                             *
    ;*  Date      : 06/05/06                                        *
    ;*  Version   : 2.47                                            *
    ;*  Notes     :                                                 *
    ;****************************************************************
            NOLIST
        ifdef PM_USED
            LIST
            "Error: PM does not support this device.  Use MPASM."
            NOLIST
        else
            LIST
            LIST p = 18F1330, r = dec, w = -311, w = -230, f = inhx32
            INCLUDE "P18F1330.INC"  ; MPASM  Header
            __CONFIG    _CONFIG1H, _OSC_INTIO2_1H 
           ; __CONFIG    _CONFIG1H, _OSC_XT_1H
            __CONFIG    _CONFIG2H, _WDT_ON_2H & _WDTPS_512_2H
            __CONFIG    _CONFIG4L, _XINST_OFF_4L
            NOLIST
        endif
            LIST
    EEPROM_START	EQU	0F00000h
    BLOCK_SIZE	EQU	8
    
    '==============================================================================
    '==============================================================================
    
    ;****************************************************************
    ;*  18F1320.INC                                                 *
    ;*                                                              *
    ;*  By        : Leonard Zerman, Jeff Schmoyer                   *
    ;*  Notice    : Copyright (c) 2006 microEngineering Labs, Inc.  *
    ;*              All Rights Reserved                             *
    ;*  Date      : 06/05/06                                        *
    ;*  Version   : 2.47                                            *
    ;*  Notes     :                                                 *
    ;****************************************************************
            NOLIST
        ifdef PM_USED
            LIST
            "Error: PM does not support this device.  Use MPASM."
            NOLIST
        else
            LIST
            LIST p = 18F1320, r = dec, w = -311, w = -230, f = inhx32
            INCLUDE "P18F1320.INC"  ; MPASM  Header
            __CONFIG    _CONFIG1H, _INTIO2_OSC_1H    ; this for INT OSC 
        ;   __CONFIG    _CONFIG1H, _XT_OSC_1H	 ;was this for XT OSC
            __CONFIG    _CONFIG2H, _WDT_ON_2H & _WDTPS_512_2H
            __CONFIG    _CONFIG4L, _LVP_OFF_4L
            NOLIST
        endif
            LIST
    EEPROM_START	EQU	0F00000h
    BLOCK_SIZE	EQU	8
    the commented out part was my addition, but notice the different syntax for the oscillator statement.
    Just hadn't run into that before.
    Bo

  2. #2
    Join Date
    Feb 2008
    Location
    Michigan, USA
    Posts
    231


    Did you find this post helpful? Yes | No

    Default Can't find @MyConfig

    Hi all,

    I have tried to find where the @MyConfig references were without any success. Anyone have them bookmarked?
    I still don't have a good handle on changing these without tweaking the .inc files and I'm afraid that's going to bite me someday (even though I do leave the original lines REM'd).

    I have seen @MyConfig used, but don't know if there are any caveats.

    Thanks
    Bo

  3. #3
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    Hi Bo,
    @__Config MyConfig was something Darrel came up with for me, so as to be able to put the config statements on several lines. This was so I could see them without having to scroll across some 100 or so places on the screen. I have MCS set up with large fonts as I have rather poor vision. You still have to comment out the default configs and place the correct configs in your code. It simply allows you to put them on multiple lines. Search for my posts and you will find examples of it's use. If you need examples I can post some Saturday after my new cable internet connection get's hooked up, until then I am not at home while in here.
    JS
    Last edited by Archangel; - 3rd December 2009 at 04:01.
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  4. #4
    Join Date
    Aug 2006
    Location
    Omaha, Nebraska USA
    Posts
    263


    Did you find this post helpful? Yes | No

    Default

    Okay, I've rummaged through the manual, looked at several old threads, and at the "include" files for the device (16F88). I've carefully read through Melanie's post on the subject http://www.picbasic.co.uk/forum/show...16&postcount=1

    Whatever occurs after @_config generates error 122 ("illegal opcode"). It also appears that _INTRC_IO doesn't want to fly. I'm using MPASM.

    Maybe I've not found the right thread yet.

    HELP!
    Russ
    N0EVC, xWB6ONT, xWN6ONT

    "Easy to use" is easy to say.

  5. #5
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    I don't think it's what's after it, it's the config...

    @ __config _CONFIG1, _xxxx
    That's @ space two(2) underscores config space "the _CONFIG? word" comma etc...
    Only 1 underscore for the config word and options.

    DT

  6. #6
    Join Date
    Aug 2006
    Location
    Omaha, Nebraska USA
    Posts
    263


    Did you find this post helpful? Yes | No

    Default

    Yep, it was the double underscore. Then I commented out the line in the INC file, and everything is peachy-keeno.

    Thanks!
    Russ
    N0EVC, xWB6ONT, xWN6ONT

    "Easy to use" is easy to say.

Similar Threads

  1. pic program crashing
    By comwarrior in forum General
    Replies: 5
    Last Post: - 8th July 2009, 16:33
  2. HSERIN & Interupts (aka controlling PIC programs from a remote PC)
    By HankMcSpank in forum mel PIC BASIC Pro
    Replies: 16
    Last Post: - 17th June 2009, 14:46
  3. Making Program Code Space your playground...
    By Melanie in forum Code Examples
    Replies: 15
    Last Post: - 19th July 2008, 08:26
  4. size of program vs mem on pic
    By PICMAN in forum General
    Replies: 1
    Last Post: - 1st March 2005, 17:23
  5. Serial communication PIC to PIC help.
    By Rubicon in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 24th January 2005, 15:45

Members who have read this thread : 11

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