Bootloader For 18F4520


Results 1 to 37 of 37

Threaded View

  1. #24
    Join Date
    Feb 2006
    Location
    Gilroy, CA
    Posts
    1,530


    Did you find this post helpful? Yes | No

    Default 20mhz bootloader and 48mhz code

    Ok, this works for me. I'm using microcode stuidios 18f4550 20mhz hex bootloader file, and change the speed to 48mhz on the fly using Darrel's RTconfig.inc file.

    Will post code tonight for a 18f4520

    Code:
    DEFINE OSC 48	' Lets work at 48 MHz with our 20mhz bootloader!
    define LOADER_USED 1
    @ #include "RTconfig.inc"  ;Darrel's write to configs while running inc
    tempbyte var byte
    redled		var PORTD.1
    
    ;----Change back to low speed for bootloader at reset
    @  ReadConfig?CB  _CONFIG1L, _tempbyte    ; Read  CONFIG1L
    tempbyte.0=1
    tempbyte.1=1
    @  WriteConfig?CB  _CONFIG1L, _tempbyte   ; Write CONFIG1L
    @  ReadConfig?CB  _CONFIG1H, _tempbyte    ; Read  CONFIG1H
    tempbyte.1=0
    @  WriteConfig?CB  _CONFIG1H, _tempbyte   ; Write CONFIG1H
    
    pause 1000   ; Give bootloader time to do it's thing 
    ;----Accelerate up to 48mhz for your code
    @  ReadConfig?CB  _CONFIG1L, _tempbyte    ; Read  CONFIG1L
    tempbyte.0=0
    tempbyte.1=0
    @  WriteConfig?CB  _CONFIG1L, _tempbyte   ; Write  CONFIG1L
    @  ReadConfig?CB  _CONFIG1H, _tempbyte    ; Read  CONFIG1H
    tempbyte.1=1
    @  WriteConfig?CB  _CONFIG1H, _tempbyte
    
    main:
    	pause 500
    	high redled
    	pause 500
    	low  redled
    	goto main
    end
    Last edited by ScaleRobotics; - 20th March 2010 at 19:11.

Similar Threads

  1. PIC18F4680 bootloader
    By vinyl_theif in forum General
    Replies: 1
    Last Post: - 29th January 2009, 18:45
  2. 18F4550 Bootloader enter via eeprom setting
    By bradb in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 23rd November 2008, 00:51
  3. USBDemo with Bootloader
    By vacpress in forum USB
    Replies: 4
    Last Post: - 25th January 2007, 23:29
  4. Bootloader Problems
    By rossfree in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 11th February 2005, 18:51
  5. Replies: 3
    Last Post: - 26th January 2005, 14:41

Members who have read this thread : 0

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