No announcement yet.

DEFINE OSC question

  • Filter
  • Time
  • Show
Clear All
new posts

  • DEFINE OSC question

    The last time I used PBP was a number of years ago and I just updated to V3, MCSP and trying to get things working again, but a bit unclear about what freq needs to be defined when using a 10MHz crystall and HSPLL osc setting. I've been searching forums and have only found examples for a HS osc which often have a comment like "10MHz crystal freq" following the DEFINE OSC statement which leads me to think that it's the crystal freq one needs to define, but have not found an example for a HSPLL osc and unsure if the software determines what the final freq will be from the HSPLL setting and I simply need to define my 10MHz crystal freq or I need to define the resulting 40MHz PLL osc freq of the 18F452 I'm using?

    In case it may be different, I have the same question regarding the UMC builder application used to create a loader .hex file. I specified a 10MHz Osc, HSPLL osc, programmed a 18F452 using a PicStart programmer that's now soldered into a circuit and figured I had better get clarification on all of this before trying to reprogram the 18F452 in-circuit in case a different problem is preventing the bootloader from working.

  • #2
    Hi Barry,

    DEFINE OSC tells PBP what frequency the CPU will be running at, so that it can adjust timing of the commands to match.
    It doesn't matter what the actual crystal frequency is.

    The 18F452 is a fairly old device, and as such has a basic and easy to understand oscillator.
    If you have a 10Mhz crystal, and enable the 4x PLL, the CPU will be running at 40Mhz.
    Therefore the define should be ...
    On some USB chips, you might be using a 4Mhz crystal, with the CPU running at 48Mhz from the 96Mhz PLL.
    In that case, it would still be the same idea. The CPU is running at 48Mhz, so the define is ...
    PBP3 Manual : Microchip Datasheets - 10F, 12F, 16F, 18F
    Never download a PIC datasheet from anywhere but


    • #3
      Thanks for confirming what I figured I had done wrong. Luckily I also ordered a U2 USB Programmer when I upgraded my software so it won't be too hard to reprogram the chip now that's it's soldered into a circuit. And yes, the 18F452 is a bit old and one from when I was last working with PIC's.