PIC 18F242 not starting


Closed Thread
Results 1 to 6 of 6
  1. #1
    Join Date
    Feb 2006
    Location
    Isle of Man
    Posts
    32

    Default PIC 18F242 not starting

    My circuit uses an 18F252 with 20MHz low profile crystal and 33nF capacitors for the clock. Power comes from a 7V bench supply, through a standard 7805 regulator and a MAX232 is used for serial to a PC. There are 100nF power line decoupling capacitors scattered on the board. My problem is that, on switch on, the PIC fails to start about 7 times out of 10. Also, the program often stops and the PIC re-starts at random. The same thing happens when the PIC sends instructions to a DAC.

    Has anyone any experience of this problem and a suggested solution?

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


    Did you find this post helpful? Yes | No

    Default

    Some suggestions...

    1. I assume 33pF and not nF!!! Even 33pF seems a bit large for a 20MHz xtal, whilst 33nF should be enough to kill your Oscillator dead!!

    2. 7v into a 7805 Regulator is really 'marginal'. What's the 5v rail like under the worst case load conditions?

    3. PIC Restarting could be noise on the MCLR pin or the volts dropping to the Brown-Out setting (see point 2 above). The Brown-Out setting I believe is software adjustable, it may be set too high.

    4. If you can... get a 18F2520 just to debug your board... it has two features... (a) you can run on internal oscillator (but not at 20MHz) and (b) you can run on internal MCLR. Those two features can help to identify if you have external Oscillator or MCLR problems.

    5. Very very early 18F24x's and 18F25x's (I'm talking some three years back) had heaps of problems as they were very fussy as to noise. A bad board design could kill the whole project. Make sure you haven't got one of those.

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


    Did you find this post helpful? Yes | No

    Default

    Would be nice to see some schematic and config fuses.
    Steve

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

  4. #4
    Join Date
    Feb 2006
    Location
    Isle of Man
    Posts
    32


    Did you find this post helpful? Yes | No

    Smile PIC 18F 242 not starting

    Thanks Melanie and Mister E for your kind advice - that was extremely helpful, as I will explain:

    The crystal capacitors were actually 33 pF (!) but I changed them to 22pF and this improved the starting, but there was still a random re-start problem. On my board the DAC's control lines (Clock, Latch Enable & Data) are connected to PortB.7, PortB.6 and PortB.5, respectively, and I found that when the PIC sent controls to the Latch Enable pin the PIC froze. The problem was due to the fact that the Low Voltage Programming (LVP) fuse was set as Enabled in the MElabs programmer configuration, and of course these 3 pins on Port B are used for programming! The solution was to change the LVP fuse to Disable, and then the DAC and the PIC worked perfectly.

    Thanks you guys!

  5. #5
    Join Date
    Mar 2007
    Posts
    5


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by manxman View Post
    My circuit uses an 18F252 with 20MHz low profile crystal and 33nF capacitors for the clock. Power comes from a 7V bench supply, through a standard 7805 regulator and a MAX232 is used for serial to a PC. There are 100nF power line decoupling capacitors scattered on the board. My problem is that, on switch on, the PIC fails to start about 7 times out of 10. Also, the program often stops and the PIC re-starts at random. The same thing happens when the PIC sends instructions to a DAC.

    Has anyone any experience of this problem and a suggested solution?
    have you set you program option to hs oscillator??????????

  6. #6
    Join Date
    Feb 2006
    Location
    Isle of Man
    Posts
    32


    Did you find this post helpful? Yes | No

    Smile PIC not starting

    Yes, the program has a header line defining this oscillator frequency. The problem is solved as described before.

Similar Threads

  1. SMS via pic
    By kenandere in forum GSM
    Replies: 15
    Last Post: - 10th March 2010, 10:00
  2. HSERIN & Interupts (aka controlling PIC programs from a remote PC)
    By HankMcSpank in forum mel PIC BASIC Pro
    Replies: 16
    Last Post: - 17th June 2009, 14:46
  3. pic to pic ir link versus wired link : help please anyone
    By xnihilo in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 30th May 2008, 21:01
  4. Starting PC from PIC
    By Tissy in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 25th February 2006, 14:42
  5. Serial Pic to Pic using HSER
    By Chadhammer in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 11th March 2005, 23:14

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