PIC16F877A not working again :(


Closed Thread
Results 1 to 25 of 25

Hybrid View

  1. #1
    Join Date
    Jun 2007
    Location
    Mansfield, UK
    Posts
    697


    Did you find this post helpful? Yes | No

    Default

    Its not in backwards. I know it can happen, Ive done it pleanty of times myself. Usually i put it in the programmer the wrong way. This is definately correct though. I am using the OSC1 and OSC2 pins for a 3 pin resonator (20MHz). MCLR is being used as MCLR. I dont see any options to use it as an I/O pin on this chip. It has a 10K resistor to VDD.

    CMCON doesnt make much sense to me but that only seems to affect portA. My Code tested portD by turning 2 outputs on and off alternately. mister_e's code tests both portA and portB. I had trouble with portA before but at least portB worked. The only thing i see about portD is that it can act as a parallel port. The datasheet says trisE.4 must be set to enable "PSPMODE" but its default value is 0 so portD should be working as normal I/O pins.

    The values of portD are unknown at startup. Usually that means the LEDs i have connected will flash sometimes when the PIC powers up. This time there not doing. Its like the chip is never turning on. I thought there might be a problem with my breadboard so i tested the power pins on the PIC and there is definately power getting there.

    Ill have a go with your test code when i get home but for now ill continue reading the datasheet to see if there are any other registers that might affect it

  2. #2
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,653


    Did you find this post helpful? Yes | No

    Talking Copy n' paste backdraw ...

    Ha,Ha,Ha


    ive tried mister_e's code from last time.
    Code:
     ifdef PM_USED
                device  pic16F877A, xt_osc, wdt_on, lvp_off, protect_off
            else
                __config _XT_OSC & _WDT_ON & _LVP_OFF & _CP_OFF
            endif
            endasm

    I am using the OSC1 and OSC2 pins for a 3 pin resonator (20MHz).

    Dit you also try to heat your pic, just some degrees ????

    could be another solution ... the Hardware one

    Alain
    Last edited by Acetronics2; - 21st October 2008 at 10:06.
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  3. #3
    Join Date
    Jun 2007
    Location
    Mansfield, UK
    Posts
    697


    Did you find this post helpful? Yes | No

    Default

    I know last time i was using a 4MHz one instead. Whats bad about using that code with a 20MHz?

    The test code i wrote myself has "DEFINE OSC 20" at the top so that should have worked

    Edit: The PIC didnt get noticably warmer at all
    Last edited by The Master; - 21st October 2008 at 10:23.

  4. #4
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by The Master View Post
    I know last time i was using a 4MHz one instead. Whats bad about using that code with a 20MHz?
    The test code i wrote myself has "DEFINE OSC 20" at the top so that should have worked
    Edit: The PIC didnt get noticably warmer at all
    Check the datasheet, Oscillator section in particular...
    Have to change the oscillator configuration from XT to HS when using a higher frequency crystal/resonator/etc.

  5. #5
    Join Date
    Jun 2007
    Location
    Mansfield, UK
    Posts
    697


    Did you find this post helpful? Yes | No

    Default

    I see. The datasheet says XT is for 200KHz to 4MHz. Anything above that is HS. I checked the datasheet for PIC16F87 too and that says the same thing yet ive been using one with a 20MHz resonator without setting it to HS. Ill change the 16F877A to HS when i get home

  6. #6
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by The Master View Post
    I see. The datasheet says XT is for 200KHz to 4MHz. Anything above that is HS. I checked the datasheet for PIC16F87 too and that says the same thing yet ive been using one with a 20MHz resonator without setting it to HS. Ill change the 16F877A to HS when i get home
    I think you've just been lucky so far. Some of the various oscillator modes (XT, HX, etc) change the 'gain' inside the PIC, drive the crystal/resonator/whatever harder at higher freq's.
    The F87 is a bit newer than the F877A. Maybe it's a bit more tolerant of that sort of thing.

  7. #7
    Join Date
    Jun 2007
    Location
    Mansfield, UK
    Posts
    697


    Did you find this post helpful? Yes | No

    Default

    So if i set it to XT when it should be HS then i dont risk blowing anyhting up it just means that the resonator might not have enough power to run correctly?

    From what ive seen the PIC seems to be in a kind of standby mode. I do remember them doing the same kind of thing if the resonator isnt connected so that might be the problem.

Similar Threads

  1. PIC16F877A PORTA.2 not working
    By The Master in forum Off Topic
    Replies: 2
    Last Post: - 10th October 2009, 18:16
  2. PIC16F877A analog problem
    By DeViLa_Q8 in forum mel PIC BASIC
    Replies: 0
    Last Post: - 30th July 2009, 20:19
  3. PIC16F877A for application in mobile robot...
    By mcbeasleyjr in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 30th January 2009, 14:47
  4. PIC16F877A not working
    By The Master in forum General
    Replies: 6
    Last Post: - 16th November 2007, 11:32
  5. communicating pic18f452 with pic16f877a
    By tamersoss in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 13th July 2007, 19:54

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