18F252 config


Closed Thread
Results 1 to 6 of 6

Thread: 18F252 config

  1. #1
    Join Date
    Sep 2006
    Location
    Venezuela - Caracas
    Posts
    48

    Default 18F252 config

    i need change my config because 18F2520 finish in my city....then i but 18F252 and
    i have problem with config

    code/pic work with 8 mhz internal oscilator with pll = 32mhz

    Code work 100%
    Code:
       asm   
          __CONFIG    _CONFIG1H, _OSC_INTIO7_1H & _IESO_OFF_1H
          __CONFIG    _CONFIG2H, _WDT_OFF_2H & _WDTPS_512_2H
          __CONFIG    _CONFIG3H, _PBADEN_OFF_3H
          __CONFIG    _CONFIG4L, _LVP_OFF_4L & _XINST_OFF_4L
          __CONFIG    _CONFIG5L, _CP0_ON_5L & _CP1_ON_5L & _CP2_ON_5L & _CP3_ON_5L
          __CONFIG    _CONFIG5H, _CPB_ON_5H
       endasm
    
       DEFINE   HSER_RCSTA    90h
       DEFINE   HSER_TXSTA    20h
       DEFINE   HSER_BAUD     9600
       DEFINE   HSER_CLROERR  1
    
    '-------------------------------------------------------------------------------
       Led               var   PORTC.4
          
    '-------------------------------------------------------------------------------   
    
       I                 Var   WORD
       J                 Var   BYTE
    	
    '-------------------------------------------------------------------------------	
    Boot:
       
       DEFINE OSC 32
       
       OSCCON = %11110000                           ' 8 Mhz, internal osc
       OSCTUNE = %11000000                          ' 4x PLL enabled
    
       CMCON = 7
       ADCON1 = 15                                  ' Port A digital
       INTCON2.7 = 0                                ' Ativa Pull-Ups
       
       LATA = 0
       LATB = 0
       
       PORTA = 0
       TRISA = %00000000
    
       PORTB = 0
       TRISB = %10101110
       
       PORTC = 0
       TRISC = %10000000
    
       Led = 1
       pause 2000   
             
       hSEROUT ["-"]
       PAUSE 1   
       hSEROUT ["START", 13, 10]
       pause 1
         
       Led = 0
    
       i = 0
    Loop:
       Hserout[65 + I, 13]
    Goto Loop
    i try....not work
    Code:
       asm      
    ***
    i try .....
          .. __CONFIG    _CONFIG1H, _HS_OSC_1H
          .. __CONFIG    _CONFIG1H, _HSPLL_OSC_1H
          .. __CONFIG    _CONFIG1H, _RC_OSC_1H
          .. __CONFIG    _CONFIG1H, _OSCS_ON_1H & _RC_OSC_1H
          .. __CONFIG    _CONFIG1H, _OSCS_OFF_1H & _HS_OSC_1H
          .. __CONFIG    _CONFIG1H, _RCIO_OSC_1H
    ***     
    
          __CONFIG    _CONFIG2H, _WDT_OFF_2H & _WDTPS_128_2H
          __CONFIG    _CONFIG4L, _LVP_OFF_4L
          __CONFIG    _CONFIG5L, _CP0_ON_5L & _CP1_ON_5L & _CP2_ON_5L & _CP3_ON_5L
          __CONFIG    _CONFIG5H, _CPB_ON_5H
       endasm
    
       DEFINE   HSER_RCSTA    90h
       DEFINE   HSER_TXSTA    20h
       DEFINE   HSER_BAUD     9600
       DEFINE   HSER_CLROERR  1
    
    '-------------------------------------------------------------------------------
       Led               var   PORTC.4
          
    '-------------------------------------------------------------------------------   
    
       I                 Var   WORD
       J                 Var   BYTE
    	
    '-------------------------------------------------------------------------------	
    Boot:
       
       DEFINE OSC 32
       
       OSCCON = %11110000                           ' 8 Mhz, internal osc
       '-- disable in 252 OSCTUNE = %11000000                          ' 4x PLL enabled
    
       '-- disable in 252 CMCON = 7
       ADCON1 = 15                                  ' Port A digital
       INTCON2.7 = 0                                ' Ativa Pull-Ups
       
       LATA = 0
       LATB = 0
       
       PORTA = 0
       TRISA = %00000000
    
       PORTB = 0
       TRISB = %10101110
       
       PORTC = 0
       TRISC = %10000000
    
       Led = 1
       pause 2000   
             
       hSEROUT ["-"]
       PAUSE 1   
       hSEROUT ["START", 13, 10]
       pause 1
         
       Led = 0
    
       i = 0
    Loop:
       Hserout[65 + I, 13]
    Goto Loop
    Last edited by mpardinho; - 15th July 2008 at 21:16.
    ..: Don't worry, be happy :..

  2. #2
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    All possible/relevant CONFIG fuses options are listed at the end of the MPASM .INC files for your particular PIC. Those should help you figure out which ones you need and which ones are incorrect (whether it be spelling, options that are/aren't present, etc).
    And exactly what is your question? Having trouble decoding the English...
    What isn't working right? What error messages?
    Last edited by skimask; - 15th July 2008 at 21:20.

  3. #3
    Join Date
    Sep 2006
    Location
    Venezuela - Caracas
    Posts
    48


    Did you find this post helpful? Yes | No

    Default

    The real problem is i need that my 18f252 work with internal oscilator and 32mhz,
    in pic18d2520 i use config above and work 100%

    asm
    __CONFIG _CONFIG1H, _OSC_INTIO7_1H & _IESO_OFF_1H
    ...

    and

    DEFINE OSC 32

    OSCCON = %11110000 ' 8 Mhz, internal osc
    OSCTUNE = %11000000 ' 4x PLL enabled

    i need help for corret config in 18F252
    ..: Don't worry, be happy :..

  4. #4
    Join Date
    Sep 2005
    Location
    Campbell, CA
    Posts
    1,107


    Did you find this post helpful? Yes | No

    Default

    Charles Linquist

  5. #5
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    This is cut & paste directly from the 18F252 data sheet:

    2.1 Oscillator Types

    The PIC18FXX2 can be operated in eight different Oscillator modes. The user can program
    three configuration bits (FOSC2, FOSC1, and FOSC0) to select one of these eight modes:

    1. LP Low Power Crystal
    2. XT Crystal/Resonator
    3. HS High Speed Crystal/Resonator
    4. HS + PLL High Speed Crystal/Resonator with PLL enabled
    5. RC External Resistor/Capacitor
    6. RCIO External Resistor/Capacitor with I/O pin enabled
    7. EC External Clock
    8. ECIO External Clock with I/O pin enabled

    Note there is no internal oscillator option for the 252. Oops...;o}
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  6. #6
    Join Date
    Sep 2006
    Location
    Venezuela - Caracas
    Posts
    48


    Did you find this post helpful? Yes | No

    Default

    thaks all for help.......realy 452 not have internal oscilator.......vendor sad 252 = 2520
    arggggggggg.....i'm a donkey....i not read pdf
    ..: Don't worry, be happy :..

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 : 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