16F88 bootlader with Internal OSC


Closed Thread
Results 1 to 11 of 11
  1. #1
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,520

    Default 16F88 bootlader with Internal OSC

    Hi guys,
    Does anyone have a bootloader file for the 'F88 set up for the internal oscillator @4Mhz?

    I've tried to import the one supplied with MCLoader (setup for external oscillator) into MPLAB and changing the Config bits manually but if I've figured this out correctly you also need to set the OSCCON-register to $68 in order for the internal oscillator to actually run at 4MHz. Initially I tried to change that in MPLAB as well (View->Special Function Registers)but obviously that won't work since the OSCON register is in RAM... doh...

    So, does anyone have such a bootloader file or can assist me with a way to modify the existing one to work with the internal oscillator?

    Oh, and I have verified serial comms using the USART by compiling a small program and programming the device with the PICStart+. It echos charcters sent to it at @2400baud so that part is working.

    Thanks!
    /Henrik.

  2. #2


    Did you find this post helpful? Yes | No

    Default MCSP bootloader seems to work for me

    I just compiled a PBP program using the MeLabs USB serial programmer for the 16F88 on internal clock. I selected the 16F88_04 from C:\Program files\Mecanique\MCSP\MCLoader\16F88\16F88_04.

    Call up the CONFIG word (click the 'C' beside the PIC16F88 dropdown) and there you can select the various clock modes you want.

    In your code you will need an OSCCON statement to select 4 MHz and possibly a speed tweak via OSCTUNE.

    Seems to work for me.

    HTH
    BrianT

  3. #3
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,520


    Did you find this post helpful? Yes | No

    Default

    Thanks Brian,
    That's pretty much what I've done. I import the 16F88_04.hex in MPLAP, change the config-bits to internal oscillator and program the chip with my PICSTART+.

    BUT I can't get my application downloaded thru the bootloader since the command that sets the OSCCON register is in MY application program and not in the bootloader stub currently running on the chip.

    The chip boots up on the internal oscillator @31.25kHz but since nothing in the bootloader .hex file sets the OSCCON register the chip keeps running at that speed and the bootloader is a no-go...

    So what I need is to somehow modify the 16F88_04.hex file to include a command that sets OSCCON to $68 so that the chip speeds up from 31.25kHz to 4Mhz when it starts up....I think ;-)

    Or did I completely missed your point?

    Thanks again!
    /Henrik.

  4. #4
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Hi Henrik,

    Give this a try ...

    I've modified the 16F88_04.HEX file to jump to a new location, set OSCCON to $60 (4mhz) then jump back to the bootloader.

    I've changed the OSC to INTIO, and used the Serial Number dialog in meProg to modify certain locations of the HEX file with new RAW instructions.
    It's kind of like flipping switches on the front panel of an Altair 8080.

    I think it will work, but it's a bit of a gamble.

    hth,
    Attached Files Attached Files
    DT

  5. #5
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,520


    Did you find this post helpful? Yes | No

    Default

    Thanks a lot Darrel,
    I'll give it a go first thing in the morning, concidering your track record I feel confident ;-) I'll let you know ASAP though.

    I guess you changed the Goto bootloader adress to actually jump past the bootloader, setting OSCCON and then back to the bootloader? Or do I need to worry about overwriting those 'certain locations'?

    Never used meProg but I did spend a couple of hours today looking for dissassemblers and stuff, found a few, some I couldn't get to work at all, and some showed me an asm listing but no way to save it without coughing up money (fair enough I guess).

    And of course, OSCCON should be set to $60 and not $68, don't know why I was trying to set a read-only bit.....

    Again, thanks alot!
    /Henrik.

  6. #6
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by HenrikOlsson View Post
    I guess you changed the Goto bootloader adress to actually jump past the bootloader, setting OSCCON and then back to the bootloader? Or do I need to worry about overwriting those 'certain locations'?
    Yes, there's a small area just past the bootloader that didn't appear to be used, and I only put about 5 words in there. So it won't affect the amount of code you would normally be able to use.

    My only fear is if that area is used by the bootloader, it may only work once. I don't think it will overwrite it, but I can't test it here to be sure.

    Fingers crossed.


    And of course, OSCCON should be set to $60 and not $68, don't know why I was trying to set a read-only bit.....
    Since you can't write to that bit ... a 1 is just as valid as a 0.
    DT

  7. #7
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,520


    Did you find this post helpful? Yes | No

    Default

    Hi Darrel,
    Your bootloader file seems to be working perfectly! I've only downloaded a few very short test-programs but so far but it seems to work just fine.

    Now off to get a 100Hz timer interrupt going, with DT-Ints of course ;-)

    Thank you!
    /Henrik.

  8. #8
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Great. sometimes a gamble pays off.

    Now off to get a 100Hz timer interrupt going, with DT-Ints of course ;-)
    Of course.

    Using the Timer Template ?
    <br>
    DT

  9. #9
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,520


    Did you find this post helpful? Yes | No

    Default

    Hi Darrel,
    Yes, using the timer template I was able to get it going in a matter of minutes - awsome piece of work that Instant Interrupt system!

    A bit OT: I've also started playing a bit with this Ladder compiler for PIC's, pretty cool and the hex-files it produces leaves the first four bytes of program memory empty so I can program the chip with MCLoader, sweet.

    /Henrik.

  10. #10
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Hmmm, was it a Freudian slip.
    Funny how the thread was spelled ... and it ends up you're using a Ladder program.

    Back when I was working with PLC's I never really liked dealing with Ladder Logic.
    That program you pointed to brought back some Scary memories.

    But thanks for pointing it out, because I'm really interested in the SolveSpace program on the same website.

    That'll suck up a few hundred hours of my time.
    <br>
    DT

  11. #11
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,520


    Did you find this post helpful? Yes | No

    Default

    Hi Darrel,
    Yeah, I noticed I had mis-spelled the thread title, I hate it when that happens and I can't seem to figure out how to go back and edit it.

    I'm not very comfortable with ladder programming myself but I think it has its place. I did look at the solve space video on the site, pretty cool, please don't disappear from here ;-)

    /Henrik.

Similar Threads

  1. Internal vs. external osc for comms
    By mtripoli in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 29th January 2010, 14:58
  2. 16f88 internal osc 8mhz max serial baudrate ?
    By RFsolution in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 16th December 2008, 23:27
  3. 18F4520 and internal osc & PLL
    By pwhitt in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 15th September 2008, 06:38
  4. Internal Osc help
    By BobK in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 12th January 2007, 20:50
  5. 12f675 internal osc question.....
    By Gabe@SPdFtsh in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 6th January 2004, 06:33

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