XT oscillator mode & configuration bits


Closed Thread
Results 1 to 5 of 5
  1. #1
    Join Date
    Apr 2008
    Posts
    24

    Default XT oscillator mode & configuration bits

    Good evening. I want to use 18F452 with "XT" oscillator mode (4 MHz xtal)

    I have read the thread "18F Config fuses", and there is just one question in my mind :

    If I use the statement "config OSC=XT" in MPASM,
    then I do NOT have to write into "CONFIG1H" ?
    ( I think the "XT oscillator" corresponds to a value of 0x21 )

    Is there any way to confirm this, watching the CODE.HEX file ?

    Thanks. Ramon.

  2. #2
    Join Date
    Sep 2006
    Location
    Mexico
    Posts
    47


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Ramonetnet View Post
    Good evening. I want to use 18F452 with "XT" oscillator mode (4 MHz xtal)

    I have read the thread "18F Config fuses", and there is just one question in my mind :

    If I use the statement "config OSC=XT" in MPASM,
    then I do NOT have to write into "CONFIG1H" ?
    ( I think the "XT oscillator" corresponds to a value of 0x21 )
    Just one time

    Is there any way to confirm this, watching the CODE.HEX file ?

    Thanks. Ramon.

    Import .hex file and check configuration fuses

  3. #3
    Join Date
    Apr 2008
    Posts
    24


    Did you find this post helpful? Yes | No

    Default

    Xcuse my poor english, mr Raflex, but ... what does "Just one time" mean ?
    I HAVE TO SET "CONFIG1H" or NOT ?

    And to the second part ... when you say "IMPORT THE HEX FILE" ...
    ... you mean into which tool ???

    Thanks for your help. Ramon.

  4. #4
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,614


    Did you find this post helpful? Yes | No

    Wink Example

    Hi, Ramon

    hre you have an example for a '452


    '************************************************* ****************************
    '************************************************* ****************************
    'Config processeur
    '************************************************* ****************************
    '

    '@ __CONFIG _CONFIG1L, _WDT_OFF_1L & _WDTPS_128_1L
    @ __CONFIG _CONFIG1H, _OSCS_OFF_1H & _XT_OSC_1H
    @ __CONFIG _CONFIG2L, _BOR_OFF_2L & _BORV_27_2L & _PWRT_ON_2L
    @ __CONFIG _CONFIG2H, _WDT_OFF_2H & _WDTPS_128_2H
    '@ __CONFIG _CONFIG3L, _WDT_OFF_3L & _WDTPS_128_3L
    @ __CONFIG _CONFIG3H, _CCP2MX_OFF_3H
    @ __CONFIG _CONFIG4L, _STVR_OFF_4L & _LVP_OFF_4L & _DEBUG_OFF_4L
    '@ __CONFIG _CONFIG4H, _WDT_ON_4H & _WDTPS_128_4H
    @ __CONFIG _CONFIG5L, _CP0_OFF_5L & _CP1_OFF_5L & _CP2_OFF_5L & _CP3_OFF_5L
    @ __CONFIG _CONFIG5H, _CPB_OFF_5H & _CPD_OFF_5H
    @ __CONFIG _CONFIG6L, _WRT0_OFF_6L & _WRT1_OFF_6L & _WRT2_OFF_6L & _WRT3_OFF_6L
    @ __CONFIG _CONFIG6H, _WRTC_OFF_6H & _WRTB_OFF_6H & _WRTD_OFF_6H
    @ __CONFIG _CONFIG7L, _EBTR0_OFF_7L & _EBTR1_OFF_7L & _EBTR2_OFF_7L & _EBTR3_OFF_7L
    @ __CONFIG _CONFIG7H, _EBTRB_OFF_7H
    It's a PbP example, so ... just remove the "@" if pure asm from MPLAB ...

    Better to write ALL the config at top of program : that avoids bad surprises !!!

    Alain

    PS: to verify in MPLAB :

    1) FILE\ Import \ Yourfile.Hex

    2) CONFIGURE\ Configuration bits
    Last edited by Acetronics2; - 23rd April 2008 at 10:48.
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  5. #5
    Join Date
    Apr 2008
    Posts
    24


    Did you find this post helpful? Yes | No

    Default

    mr ACETRONICS : thanks for the sample.

    Here is my code ( I am using MPLAB IDE v 8.0, just downloaded from MicroPic ),
    which says basically the same : a value for configuration bits.

    My question was if that line ( config OSC=XT ) is enough at run time,
    as I see it does NOT generate any code, and we want position 0x300001 to have a 0x25, don't we ?

    Thanks for the "IMPORT HEX FILE" trick.
    It looks like "config OSC=XT" does generate the code !

    Maybe it is this line in the HEX file :

    :0100010021DD

    In some (strange) way, the first "01" shall say "0x300000", the next "00001" selects "0x300001", then the data is "0021" hex, and 0xDD must be some kind of checksum ...

    Ramon.

    ================================================== =============

    ;
    ; primer programa ASM del PIC
    ;
    ; Conectar el pin 5 (RA3) a R=1 K cap al Anode del LED.
    ; XTAL 4 MHz entre pin 13 i 14.
    ; 2x C (22pf) del pin 13 i 14 a massa.

    ; list p=16f452
    #include <p18f452.inc>

    ; Configuration bits :
    ;
    ; Oscillator mode := XT ;
    ; Watch Dog Timer := off ;
    ; Low Voltage Programming := on :

    config WDT=OFF
    config OSC=XT

    ; User data

    ===================================

    > type FLED.hex

    :020000040000FA
    :0400000080EF00F09D
    :08000800D59EF2942190110035
    :0400180020EF00F0E5
    :02002A000000D4
    :10004000D8CF23F0E8CF24F0E0CF22F022C0E0FFA9
    :0A00500024C0E8FF23C0D8FF100011
    :100100000F01936A816A926A806A0F01F28EF28A05
    :10011000550E806E92EC00F0AA0E806E9CEC00F002
    :1001200088EF00F0F00ED66E216A2180C80ED56EE1
    :1001300021B098EF00F01200FF0E206E202E9EEFEF
    :1001400000F012005555AAAA320C320C2F0C300CBC
    :10015000340C2F0C320C300C300C380C2C0C200CC6
    :10016000760C200C310C2E0C320C610C5555AAAAC1
    :020000040030CA
    :0100010021DD
    :010003000EEE
    :00000001FF

Similar Threads

  1. Bits, Bytes Words and Arrays
    By Melanie in forum FAQ - Frequently Asked Questions
    Replies: 24
    Last Post: - 14th June 2016, 07:55
  2. Configuration bits in a HEX file gone missing?
    By grzes.r in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 2nd February 2010, 01:10
  3. Configuration bits
    By Perrin` in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 3rd July 2008, 14:40
  4. Configuration bits
    By Armando Herjim in forum General
    Replies: 0
    Last Post: - 5th December 2006, 16:51
  5. error on compiling
    By parker in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 16th June 2005, 14:31

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