problem with i/o pic16F876


Closed Thread
Results 1 to 4 of 4
  1. #1
    Join Date
    Apr 2009
    Posts
    4

    Default problem with i/o pic16F876

    HI,
    I'm in troubles here. I have programmed an pic16F876 to blink an LED.
    I tried many ways to do it but the LED just blink a few times.
    I don't know why. I tried to do this with proteus and just work fine but
    in practice it didn't work.

    In same way, I tried with pic16F627 and it worked fine, I don't understand
    the difference for the two devices. Maybe in I/O hardware, I saw a few
    differences in datasheet, but how can I do it?

    Image from proteus : circuit_Proteus.jpg

    I'm using CCS C with MPLAB 8.43


    ----------------------------------------------
    C code

    #include <16F876.h>
    #FUSES XT,NOWDT,NOPROTECT,NOBROWNOUT,NOPUT
    #use delay(clock=4000000)

    void main()
    {

    SET_TRIS_B(0x00);

    for( ; ; ){
    OUTPUT_B(0x01);
    delay_ms(500);
    OUTPUT_B(0x00);
    delay_ms(500);}
    }

    ----------------------------------------------
    hex code

    :1000000000308A0019280000223084008313000881
    :10001000031918280130F800F701F70B0D28F80B29
    :100020000C284A30F700F70B13281628800B0A28F3
    :100030000034840183131F30830583161F149F141B
    :100040001F159F1100308600860101308312860043
    :100050000230A100FA30A2000420A10B2A28831646
    :100060008601831286010230A100FA30A20004202A
    :0A007000A10B352883162428630035
    :02400E00393F38
    :00000001FF
    ;PIC16F876


    ----------------------------------------------

    I already tried pullups, didn't work

    Could anyone give me some help, please!
    Attached Images Attached Images  

  2. #2
    Join Date
    May 2008
    Location
    Italy
    Posts
    825


    Did you find this post helpful? Yes | No

    Default

    You have to pullup with a 10K resistor pin 1 (MCRL) otherwise mcu will not work.

    Al.
    All progress began with an idea

  3. #3
    Join Date
    Apr 2009
    Posts
    4


    Did you find this post helpful? Yes | No

    Default problem resolved

    Just like that! I was looking many places but not
    on right terms. I did not get it without your help.
    When I did it, it has worked absolutely fine.

    -> pullup MCRL with a 10K resistor pin 1

    Many thanks, Aratti

  4. #4
    malc-c's Avatar
    malc-c Guest


    Did you find this post helpful? Yes | No

    Default

    Just goes to show you can't always trust simulators.

    Golden rules:
    1) - Place a 0.1uF capacitor across the Vcc and Vdd lines as close to the PIC as you can. If the PIC has 2 sets of supply pins use a capacitor across each set of pins
    2) - Use a pull up resistor between MCLR and +ve.
    3) - Tie all inputs to either +ve or GND via pull up or pull down resistors - typically 1K - 10K - Not advisable to leave inputs floating

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