Homicidal 877 user needs help


Closed Thread
Results 1 to 34 of 34

Hybrid View

  1. #1
    Join Date
    Dec 2007
    Location
    Northants England
    Posts
    38

    Default Homicidal 877 user needs help

    My Christmas star is in jeopardy ! I built a pcb based on 16f877 20 with ports c,d and b connected to darlinton chips, relays etc. Worked like a charm first time. Then whilst reinserting the chip after reprogramming I managed to get the pins out of line and (not surprisingly) everything stopped. I have bought some new 877's and replaced the voltage reg and every attempt to get the dam thing started has failed. I have now been reduced to a simple breadboard with oscillator (20meg) and caps. Pin 1 to Vdd via 1k. LED connected to Rb0 (via 1k to 0v) simple bit of code:
    @DEVICE PIC16F877
    DEFINE OSC 20
    main:
    HIGH portb.7
    PAUSE 500
    LOW portb.7
    PAUSE 500
    GOTO main
    END

    I have juggled around with the config settings (which I musy admit are a mystery to my ancient brain) At present the osc is set to XT
    I am using an EPIC programmer with software version 2.44 and Micro Code Studio Pic Basic Pro version 2.45.
    One other strange and seemingly unrelated mystery. My original code contained the sequence :
    High portd.0
    High portd.1
    High portd.2
    etc etc
    After the problem occurred every effort at compiling prodce a syntax error on on of the lines - I think it was d.6
    I'm sue I must be doing someting utterly stupid but I just cannot fathom out what . Any helpful suggestions would be very welcome
    Cheers

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


    Did you find this post helpful? Yes | No

    Default

    Code:
            @  DEVICE HS_OSC, LVP_OFF
            DEFINE OSC 20
            PORTB=0
            TRISB=0
    
    Start:
            Toggle PORTB.7
            PAUSE 250
            GOTO Start
    Presetting Configuration Fuses (PIC Defines) into your Program
    http://www.picbasic.co.uk/forum/showthread.php?t=543

    Most device programmer use HighVoltage programming, and use MCLR. PGD and PGC pins. hence why you MUST disable the LVP mode.

    For crystal >4MHZ, you must use HS mode.
    Last edited by mister_e; - 11th December 2007 at 18:15.
    Steve

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

  3. #3
    Join Date
    Oct 2004
    Location
    North Norfolk UK
    Posts
    146


    Did you find this post helpful? Yes | No

    Default

    Hi

    I notice that you have a 20Mhz external crystal with caps, I believe that you should be setting OSC to HS and not XT.


    did you say you have 16F877 maybe also check your new chip is the same and not an 16F877A


    Hope this may help

  4. #4
    Join Date
    May 2006
    Location
    MI
    Posts
    33


    Did you find this post helpful? Yes | No

    Default

    Did you happen to do anything differnt with the MCLR? Config fuses?
    Another thought, if you suspect the Crystal OSC, try a resonator.
    They have the caps built-in. Much simplier (in m opinion anyway).

    I believe someone already mentioned it but it your switching from the
    877 to the 877A this will cause you a problem if you don't change
    configuration.

  5. #5
    Join Date
    Dec 2007
    Location
    Northants England
    Posts
    38


    Did you find this post helpful? Yes | No

    Default

    Thanks for the responses folks. I have implemented the suggestions and the plot as they say, has now thickened ! At first using my original board with the suggested changes and at first ... nothing. Then I inadvertently touched to capacito connected to the pin 8 side of the xtal my led on rb 7 began to flash , the mark space ratio was not 1 to 1 however, the on period being significantly longer. If I touch it with metal the led remains on continuously ! The caps are 22pf all the connections seem OK.
    Yes I did try a resonator once before but didn't have a 20 meg (only 4) can I run the 877 20 at 4 if I change the define command. It might be worth a try as there is obviously an oscillator problem of some sort. I also inadvertently tried a 877a and as you say I got nowhere ..in fact the epic wouldn't program it. The chips I am using are new 877 20's
    I wish I could use the dear old 16C84 for this job that never gave me all this grief! I am beginning to detest the 877 which is a pity since it is at the heart of a midi decoder I am using in a street organ I am building. Irony is, in that far more complex circuit it works a treat... that's what is so annoying . I shall have to go and have a stiff whisky to calm me down......

  6. #6
    Join Date
    Sep 2004
    Location
    Mentor, Ohio
    Posts
    352


    Did you find this post helpful? Yes | No

    Smile

    Hi David,

    Yes you can use a 4mhz resonator or 4 mhz crystal with 22pf caps. Just change the config settings from HS to XT (actually it doesn't matter for 4 mhz but play it safe) and you should be running. The fact you mentioned just touching a capacitor made it work again makes me think you have a solder joint problem. Try re-flowing the solder to see if that clears it up. The differences between the 877 and 877A are that there are A to D's and comparators on the 877A that need to be disabled in order to use the PortA and PortE pins as digital. Check the data sheet to get the exact register names to disable.

    Also make sure you have .1uf caps on both sides of the chip as close as possible to the power supply pins. These are more important on the "A" version of the chip.

    I've used both the 877, 877A, and the drop in upgrade 18F452 and have to be honest, I didn't have any problems. I made 2 layer and 4 layer boards for them. I did have a wandering wire once though, and it took out my RTC chip and the uP. Also discovered the RTC crystal had to be replaced.

    It's all part of the game. But it's even worse when you're on a deadline to get the damn thing working.

    We're here to help David.

    HTH,

    BobK

  7. #7
    Join Date
    Dec 2007
    Location
    Northants England
    Posts
    38


    Did you find this post helpful? Yes | No

    Angry

    Well, herewe are again thanks for further suggestions. I have now changed the xtal for a 4Mh resonator with changes to the config to match. Still as dead as a dodo (rather like the 6 877's which now return the Code programming error at 0000 and have presumably died)
    RB7 (pin 40 remains at about .3 volts and for some reason pin 39 is at 4.9 I have incidentally checked and rechecked the solder connections and since the circuit initially worked perfectly there can't be much wrong with the layout. In fact with the darlington chips removed thereis nothing but the supply, the two decoupling caps (0.1) a pull up on mcr (pin 1) and the resonator and led connected to rb0. Is this annoying or what (The local cats are all going into hiding) andthe divorce can't be far off .. Ah well.

Similar Threads

  1. LCD graphic for user manuals
    By wjsmarine in forum Documentation
    Replies: 4
    Last Post: - 27th August 2009, 11:43
  2. new user with problem using PGP Pro, Lab-X3 with 16F628A
    By equipoise in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 28th July 2004, 07:42
  3. '877 and Visual Basic 6
    By Tomas in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 4th March 2004, 02:31
  4. User Configuration Interface in PBP
    By Radiance in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 7th February 2004, 08:00

Members who have read this thread : 1

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