PIC programs, resonator resonates, but does not run code.


Closed Thread
Results 1 to 10 of 10

Hybrid View

  1. #1
    Join Date
    Feb 2004
    Location
    Michigan, USA
    Posts
    305

    Default PIC programs, resonator resonates, but does not run code.

    Baffling problem. The code was tested fine on an 18 pin 18F1320 on a breadboard, the pcb uses a 20 pin 18F1320. The 20mhz resonator runs perfectly. A test program using internal RC doesnt run either. I can program and read back the code and it verified ok. Also, this is 2 different PIC's in a row.

    Any ideas what the heck the issue is? Anyone seen this before?

    Here is a short test program to turn on and off a pin:

    Code:
    Define OSC 20
    
    ADCON1 = %01111000
    ADCON2 = %10000111
    
    TRISA = %11100111
    TRISB = %11000011
    
    loop1:
    portb.2 = 1
    pause 100
    portb.2 = 0
    goto loop1
    I'm programming using HS just as I did on the breadboard. MCLR is set as an input.

  2. #2
    Join Date
    Nov 2007
    Location
    West Covina, CA
    Posts
    219


    Did you find this post helpful? Yes | No

    Default Re: PIC programs, resonator resonates, but does not run code.

    Add another PAUSE 100 to your test loop so you can see it go low.
    Code:
    loop1:
    portb.2 = 1
    pause 100
    portb.2 = 0
    PAUSE 100
    goto loop1
    Louie

  3. #3
    Join Date
    Feb 2004
    Location
    Michigan, USA
    Posts
    305


    Did you find this post helpful? Yes | No

    Default Re: PIC programs, resonator resonates, but does not run code.

    Thanks.

    It never actually goes high though.

  4. #4
    Join Date
    Feb 2004
    Location
    Michigan, USA
    Posts
    305


    Did you find this post helpful? Yes | No

    Default Re: PIC programs, resonator resonates, but does not run code.

    Well, a third PIC shows the exact same behavior. It will program and verify fine but will not execute code. I changed the resonator, same result. Will try a new pcb next.

  5. #5
    Join Date
    Feb 2004
    Location
    Michigan, USA
    Posts
    305


    Did you find this post helpful? Yes | No

    Default Re: PIC programs, resonator resonates, but does not run code.

    New pcb, new PIC, same result. Only populated the board with a 5v regulator and caps, plus resonator and PIC. Layout is good. Can program, verify, read back, erase etc etc. Again, resonator is showing clean 20mhz waveform, it just will not execute the code.

  6. #6
    Join Date
    Aug 2008
    Location
    Portugal
    Posts
    240


    Did you find this post helpful? Yes | No

    Default Re: PIC programs, resonator resonates, but does not run code.

    Try this please;

    Code:
    loop1:
    LATB.2 = 1
    pause 100
    LATB.2 = 0
    PAUSE 100
    goto loop1
    Also check if MCLR is connected to VCC. I don't see the configuration bits of your code!
    Last edited by gadelhas; - 8th August 2012 at 22:32.
    Thanks and Regards;
    Gadelhas

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