Modified include files


Closed Thread
Results 1 to 3 of 3
  1. #1
    Join Date
    Aug 2006
    Posts
    65

    Default Modified include files

    I'm trying to modify the PIC18F2620 include files so that my programs will, by default, compile/assemble with the oscillator mode set to internal and 4MHz.

    This line:
    __CONFIG _CONFIG1H, _OSC_INTIO7_1H
    will set the default oscillator mode to internal (with Fosc/4 coming out on RA6), but the default frequency for this mode seems to be 1MHz and not the 4MHz I want.

    Can someone tell me how to add/modify the include file to set the frequency to 4MHz?

    Thanks

    Joe

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


    Did you find this post helpful? Yes | No

    Default

    This is actually a 2-part process, not just a setting in the CONFIG bits but also within your program initialisation...

    Go look at the DATASHEET section 2 for Ocillator Configurations, scroll down to the OSCCON Register settings... within your program you must set OSCCON for the speed you require as you've got 8 selections from 31kHz to 8MHz (default I believe is 1MHz). So within your program you must set something like...

    OSCCON=%01100000

    ...and if you have timing critical functions, then follow that with...

    WHILE OSCCON.2=0:WEND

    to ensure your program pauses there until the Oscillator is stable.

  3. #3
    Join Date
    Aug 2006
    Posts
    65


    Did you find this post helpful? Yes | No

    Default

    Thanks Melanie,

    I figured it all out and got it to work a little earlier today. I'm finally where I wanted to be a couple days ago...I have a Microcode Studio Plus compatible loader file that works with the PIC's internal oscillator.

    I finally got it to work by disassembling the MicroCode Stuio loader hex file, finding the place where the UART initialization happens, modifying/adding some setups, and reassembling.

    Works like a charm!


    Joe

Similar Threads

  1. Continuous Interrupts when using DT_INTS and an INCLUDE file
    By jellis00 in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 15th January 2010, 21:42
  2. Can't seem to add AllDigital to the include files
    By ozarkshermit in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 12th November 2009, 04:21
  3. Missing 16F882 family include files :-(
    By campmdabt in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 27th December 2007, 01:17
  4. include files 8k limit
    By skimask in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 16th January 2006, 06:35
  5. Replies: 2
    Last Post: - 13th December 2005, 00:11

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