OSC problems...Still new


Closed Thread
Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2005
    Posts
    15

    Default OSC problems...Still new

    Ok, i can get the thing programmed and the led flashing at 4Mhz but not 20Mhz. Have a look below and any help appreciated.

    DEFINE OSC 20
    INCLUDE "modedefs.bas"
    INCLUDE "ICDDEFS4.BAS"
    ' Example program from manual to blink an LED connected to PORTB.0 about once a second


    Led Var Byte

    loop:

    High 0 ' Turn on LED connected to PORTB.0
    Pause 100 ' Delay for .5 seconds

    Low 0 ' Turn off LED connected to PORTB.0
    Pause 100 ' Delay for .5 seconds
    Goto loop

  2. #2
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    As i remind you're using PIC18F252. Right?!?

    If you're using external 20Mhz Crystal or ceramic resonator, be sure that you have set you Programmer to HS oscillator. or include this config fuse line to the top of your program

    @ __CONFIG _CONFIG1H, _HS_OSC_1H

    if you get any compile error with the above line (overwriting previous address) you must open the 18f252.INC file in the PBP directory an place an ; before the line

    __CONFIG _CONFIG1H, _OSCS_OFF_1H & _XT_OSC_1H

    this will skip the factory OSC definition

    In some case using 20Mhz ceramic resonator or crystal on BreadBoard can cause you some problems too. If you're using Crystal, try to remove the capacitor on each crystal pin. Seems the ProtoBoard do some capacitive load that can interfer with the crystal itself.

    BUT you can also use a lowest frequency resonator or crystal and multiply it, by 4, with the internal PLL of the PIC18f252 to get the frequency you need. For that, you must set HS-PLL config fuse.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

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. Replies: 2
    Last Post: - 4th January 2009, 23:35
  3. 18f2550 USB OSC Problem
    By serkanc in forum USB
    Replies: 10
    Last Post: - 29th October 2008, 20:52
  4. Problems controlling multiple pics
    By gandora in forum mel PIC BASIC Pro
    Replies: 11
    Last Post: - 29th May 2007, 08:59
  5. USART problems
    By egberttheone in forum mel PIC BASIC Pro
    Replies: 47
    Last Post: - 6th March 2005, 21:45

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