18f452 initialization


Closed Thread
Results 1 to 5 of 5
  1. #1
    Moldava's Avatar
    Moldava Guest

    Default 18f452 initialization

    Hello,
    i wrote a program for the 16f877,and want to port it to the 18f452..i know i have to use mpasm to complie it...i'd also like to know how to initialize it for using the internal 40mhz from a 10mhz crystal...
    Thanks!!!!

  2. #2
    TONIGALEA's Avatar
    TONIGALEA Guest


    Did you find this post helpful? Yes | No

    Thumbs up

    Its not difficult at all
    the way i do this is to modify the 18f452.INC file in pbp to the following :
    ;************************************************* ***************
    ;* 18F452.INC *
    ;* *
    ;* By : Leonard Zerman, Jeff Schmoyer *
    ;* Notice : Copyright (c) 2001 microEngineering Labs, Inc. *
    ;* All Rights Reserved *
    ;* Date : 12/19/01 *
    ;* Version : 2.41 *
    ;* Notes : *
    ;************************************************* ***************
    NOLIST
    ifdef PM_USED
    LIST
    "Error: PM does not support this device. Use MPASM."
    NOLIST
    else
    LIST
    LIST p = 18F452, r = dec, w = -302, f = inhx32
    INCLUDE "P18F452.INC" ; MPASM Header

    ; Configuration BYTE 1H Options
    ;_OSCS_ON_1H Oscillator Switch enable
    ;_OSCS_OFF_1H
    ;_LP_OSC_1H Oscillator type
    ;_XT_OSC_1H
    ;_HS_OSC_1H
    ;_RC_OSC_1H
    ;_EC_OSC_1H External Clock w/OSC2 output divide by 4
    ;_ECIO_OSC_1H w/OSC2 as an IO pin (RA6)
    ;_HSPLL_OSC_1H HS PLL
    ;_RCIO_OSC_1H RC w/OSC2 as an IO pin (RA6)


    NOLIST
    endif
    LIST
    EEPROM_START EQU 0F00000h
    BLOCK_SIZE EQU 8





    i then use the following
    '@ __CONFIG _CONFIG1H, _OSCS_OFF_1H & _HSPLL_OSC_1H 'for 10mhz running at 40mhz


    @ __CONFIG _CONFIG1H, _OSCS_OFF_1H & _HS_OSC_1H 'For normal 8-20mhz


    Toni

  3. #3
    TONIGALEA's Avatar
    TONIGALEA Guest


    Did you find this post helpful? Yes | No

    Wink

    Or post your code if you have any problems.
    you should not have to make changes except if you are using interupts
    and also remember that you have to define your osc speed as 40 not 10mhz

    Toni

  4. #4
    Moldava's Avatar
    Moldava Guest


    Did you find this post helpful? Yes | No

    Default

    Thanks !!!!
    i will try it today,i'm almost sure it will work,because it does not use interrupts,and no pause or oscillator related critical functions...
    Another question,is the ad converter initialization different in 18f452? i want it to convert as fast as possible,i had good results with the ad in 16f877,and i wonder if i could run it faster in the 18f...
    thanks a million again..

    Maneco

  5. #5
    TONIGALEA's Avatar
    TONIGALEA Guest


    Did you find this post helpful? Yes | No

    Cool

    Everything else should be ok , just take a read through this

    http://www.microengineeringlabs.com/.../mcu_hints.htm

    Toni

Similar Threads

  1. problem with input and output (18F452)
    By turkuaz in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 17th March 2008, 23:21
  2. Pic 16 F877 to 18F452...?
    By turkuaz in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 31st October 2007, 15:54
  3. 18F452 "Unknown Processor" errors
    By schwinn_rider in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 27th April 2006, 03:56
  4. Replies: 5
    Last Post: - 16th February 2006, 23:43
  5. Compatibility in between 16f877 and 18f452
    By BIDOUILLE in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 11th October 2005, 13:59

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