16F877 vs. 16F877A


Closed Thread
Results 1 to 13 of 13
  1. #1
    Join Date
    Jan 2008
    Location
    Pennsylvania
    Posts
    113

    Default 16F877 vs. 16F877A

    Recently I fried my old 16F877 so I ordered a replacement from Mouser. They sent me the 16F877A because that is what I ordered. It looked like according to them the direct replacement. Admitily I didn't pay much attention to the "A" on the end. I replaced it on my board from Futurlec and sent the blink.bas program down to it and I got nothing. At first I attributed that to the fact I didn't change the pic type in microstudio to a 16F877A so I did, recompiled, reprogrammed with winpic8000 and still nothing. I found this thread on this forum and noticed the initialization this person was using for their 16F877A was different specifically the type of oscillator. So I changed my settings to match those exactly and reprogrammed and it worked! I took a look at the data sheet to see what was the difference and how could I tell in the future which one of those oscillator types I should pick and I don't see anything directly in the data sheet that would explain why one worked over the other when the crystal and nothing else about the osc actually changed. I see were it talks about the different osc types in the datasheet but nothing reflects why one over the other with regards to the 2 different types of pics the 877 vs. the 877A. Did I miss were it tells me which setting I should pick or is this just a trial and error on the LP , XT or HS setting. I think the last one of RC would be obvious not to try unless you were actually using a resistor and capacitor. Is table 12-2 a good guidance for what setting to try within the range of the osc being used?

    The crystal I am using on that futurlec board is 10mhz

    Other then that my program on my pic is small I am using this to monitor a pressure transcuer on RA0 and I have a couple of small TTL relays being tripped on RA1 and RA2 and then I have one push button set up on RB0 (I've not tested the button yet on this 877A I plan to in a minute) so far everything is working find as designed and written.

    Is there any other gotchas I should be aware of that I may have overlooked switching from the 877 pic to the 877A?

    Thanks
    David

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


    Did you find this post helpful? Yes | No

    Default

    If you compare the Datasheets you'll discover the 877A has Comparators and a Voltage Reference module which can bite you if not disabled.

  3. #3
    Join Date
    Jan 2008
    Location
    Pennsylvania
    Posts
    113


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Melanie View Post
    If you compare the Datasheets you'll discover the 877A has Comparators and a Voltage Reference module which can bite you if not disabled.
    Melanie, Thanks

    To shut them down correct?
    Code:
    adcon1=7 
    cmcon=7
    By chance can you tell me the page/section that is in that discusses it? I just searched through my data sheet and I don't see anything specific to the 877A. I am obviously missing it.

    thanks for your time
    David

  4. #4
    Join Date
    Jan 2008
    Location
    Pennsylvania
    Posts
    113


    Did you find this post helpful? Yes | No

    Default

    adcon1=7 is essentially the same as ADCON1 = 1110 right? I am not a complete loser am I?

  5. #5
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    Normally you'll want to set HS_OSC for any crystal frequency over 4MHz. Some 4MHz
    crystals may work with the higher drive levels, some won't.

    With HS_OSC OSC2 provides a higher drive level to the crystal. With XT it's lower. The
    lower drive level with your 10MHz crystal was most likely not providing enough for the
    crystal to start up.

    Here's an excellent set of basic PIC training modules: http://techtrain.microchip.com/x14/

    Download & go through the one on oscillators.

    adcon1=7 is essentially the same as ADCON1 = 1110 right?
    Nope. ADCON1 = 7 is the same as ADCON1 = %00000111, which makes all analog pins
    digital.

    ADCON1 = %00001110 is the same as ADCON1 = 14, which leaves AN0 set to analog, and
    the rest digital.
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

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


    Did you find this post helpful? Yes | No

    Default

    I just searched through my data sheet and I don't see anything specific to the 877A.
    Huh? I thought the PIC16F877A Datasheet is ENTIRELY DEVOTED to the PIC16F877A!!!

    Look at the section on Comparators (section 12), look at the Voltage Reference Module (section 13).

    Datasheet=Dowloaded from Microchip
    Datasheet 877A < > Datasheet 877
    Datasheet < > PBP Manual

    adcon1=7 is essentially the same as ADCON1 = 1110 right?
    Ugh.... no.

    adcon1=7 is the same as ADCON1=%00000111... note the % in the statement specified BINARY, whilst the absence of anything implies DECIMAL.

    ADCON1=1110 is the same as ADCON1=%10001010110... now you might find that the ADCON1 register just doesn't have that many bits...

    I am not a complete loser am I?
    I don't know you well enough to validate that statement! But hey, we've all been there sometime.

  7. #7
    Join Date
    Jan 2009
    Location
    California, USA
    Posts
    323


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by DavyJones View Post
    adcon1=7 is essentially the same as ADCON1 = 1110 right? I am not a complete loser am I?

    Errr..... ADCON1 = 1110 looks more like 14 to me.

    How about ADCON1 = 0111

  8. #8
    Join Date
    Jan 2009
    Location
    California, USA
    Posts
    323


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Byte_Butcher View Post
    Errr..... ADCON1 = 1110 looks more like 14 to me.

    How about ADCON1 = 0111

    Sigh... forgot my $...

    How about ADCON1 = $0111

    Dang, I sure wish the "edit post" button would come back....




    steve

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


    Did you find this post helpful? Yes | No

    Default

    $0111 = 273 = %100010001

    Go into your OS Accessories Folder, call up the CALCULATOR, set the view into SCIENTIFIC MODE - it might help.

    I'll get back to everyone on the Forum Editing bit.

  10. #10
    Join Date
    Jan 2008
    Location
    Pennsylvania
    Posts
    113


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Melanie View Post
    Huh? I thought the PIC16F877A Datasheet is ENTIRELY DEVOTED to the PIC16F877A!!!
    You are correct they look so similiar I am so used to looking at just the 16f877 same thing happened when I was ordering too.

    Quote Originally Posted by Melanie View Post
    Ugh.... no.

    adcon1=7 is the same as ADCON1=%00000111... note the % in the statement specified BINARY, whilst the absence of anything implies DECIMAL.

    ADCON1=1110 is the same as ADCON1=%10001010110... now you might find that the ADCON1 register just doesn't have that many bits...
    Again my lack of posting correctly. I meant to say
    ADCON1=%000001110
    I abbreviated that I was trying to imply a decimal value of 111 my mistake I should have been more concise.

    I want to use RA0 as my analog in thats not a problem with the 877A is it?

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


    Did you find this post helpful? Yes | No

    Default

    Stop messing with ADCON1. If it worked for the 877 it'll work for the 'A'.

    Just deal with CMCON and CVRCON.

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


    Did you find this post helpful? Yes | No

    Default

    You might have some issue with winpic software. If I remember correctly, there's a slight difference in the programming between 16F877 and 16F877A.

    Make sure winpic support the A version or you select it before programming your PIC, and try to do a programming check.
    Steve

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

  13. #13
    Join Date
    Jan 2008
    Location
    Pennsylvania
    Posts
    113


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Melanie View Post
    Stop messing with ADCON1. If it worked for the 877 it'll work for the 'A'.

    Just deal with CMCON and CVRCON.
    Will do I just wanted to double check myself making sure I had that set correctly which it's apparent I do.

    By default it looks like according to the 16F877A (I just downloaded the correct data sheet) that CVCRON by default is off so I need'nt worry about that correct?


    You might have some issue with winpic software. If I remember correctly, there's a slight difference in the programming between 16F877 and 16F877A.

    Make sure winpic support the A version or you select it before programming your PIC, and try to do a programming check.
    I checked to make sure both microstudio and winpic have the 877A listed and made sure they were selected when I compiled and uploaded. FYI. WinPic auto detected the 877A and set itself.

    Thanks all

    David

Similar Threads

  1. 16f877 and ps/2 keyboard error???
    By boraciner in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 5th July 2009, 09:14
  2. help my bluetooth and PIC 16F877A?
    By slimpeng in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 18th March 2008, 07:52
  3. Replies: 32
    Last Post: - 23rd March 2007, 05:01
  4. Clock connection to DS1802 from 16F877A
    By coyotegd in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 3rd January 2006, 19:52
  5. 1st 16F877A program in PICBasic
    By Borisw37 in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 19th January 2005, 05:46

Members who have read this thread : 1

You do not have permission to view the list of names.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts