problem with pic16f877a !!!


Closed Thread
Results 1 to 11 of 11
  1. #1
    Join Date
    Apr 2007
    Posts
    16

    Default problem with pic16f877a !!!

    i try to use pic16f877a for the first time..

    i connected the following :

    1- 10k resistor to pin 1
    2- +5v to pin 11
    3- GND to pin 12
    4- 4MHz crystal to pin 13,14 just

    and i tryed to light a led on portb.0 by this small code:

    DEFINE OSC 4
    TRISB = %11111110

    MAIN:

    PORTB.0 = 0

    PUASE 200

    TOGGLE PORTB.0

    PUASE 200

    GOTO MAIN

    i programmed this code into pic16f84a and worked very well.

    but in pic16f877a , there is no any output , led is off for ever.
    i changed the crystal, and the voltage regulator, and the problem is still !!!

    what is the probelm??

  2. #2
    Join Date
    Jan 2006
    Location
    Istanbul
    Posts
    1,185


    Did you find this post helpful? Yes | No

    Default

    Take a look at the schematic on the following thread @ post#3.

    http://www.picbasic.co.uk/forum/showthread.php?t=7354


    Have your Vss, Vcc pins accordingly.


    Edit:
    BTW;

    Only
    Code:
     TOGGLE PORTB.0
     PUASE 200
    will do the same job.
    Last edited by sayzer; - 10th December 2007 at 16:31.
    "If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte

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


    Did you find this post helpful? Yes | No

    Default

    yup but PAUSE 200 won't return any compilation error Just kidding Sayzer!
    Steve

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

  4. #4
    Join Date
    Jun 2007
    Posts
    24


    Did you find this post helpful? Yes | No

    Default Maybe high and low will work

    Hi Ibra,
    I'm very new to this but have had to same problem. I think I was using PortA and had to set it to digital with ANSEL=0 for TOGGLE to work but

    PortB.0 High
    pause 200
    Portb.0 Low

    May also work. This shouldn't be the case here as PortB is already Digital.

    The other thing could be if you had Low voltage Programming (LVP) enabled at programming.

    You also have PortB.3 set as an input. This is also the PGM pin and if its not tied low the pic may keep resetting itself if the pin floats High.

    See how you go.

    Mike

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


    Did you find this post helpful? Yes | No

    Default

    yup but, you really need to connect all Vdd and Vss, unless, it will give you some strange things... or simply don't work.
    Steve

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

  6. #6
    Join Date
    Jan 2006
    Location
    Istanbul
    Posts
    1,185


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mister_e View Post
    yup but PAUSE 200 won't return any compilation error Just kidding Sayzer!
    oopps!
    PUASE

    just seen that.. It is in original post.
    "If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte

  7. #7
    Join Date
    Apr 2007
    Posts
    16


    Did you find this post helpful? Yes | No

    Default

    oh..sorry ..

    i compiled code for PAUSE not PUASE ( just writing error )..

    Quote Originally Posted by mikendee View Post
    The other thing could be if you had Low voltage Programming (LVP) enabled at programming.

    Mike
    mikendee, i am new with pic16f877a, and i dont know what LVP means !!!, and how can i configure it ?

    i programmed portb for output and tryed to put 2 picoF capacitors to the crystal but no result.
    should i put a capacitor between Vdd,GND ?? if should what is its value?

  8. #8
    Join Date
    Apr 2007
    Posts
    16


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mister_e View Post
    yup but, you really need to connect all Vdd and Vss, unless, it will give you some strange things... or simply don't work.
    i did ,,, no result...the pic still do nothing.

  9. #9
    Join Date
    Jan 2006
    Location
    Istanbul
    Posts
    1,185


    Did you find this post helpful? Yes | No

    Default

    ibra,

    Did you look at the schematic on the link I posted above?

    P.S. - 2pF cap on 4Mhz Xtall?
    Last edited by sayzer; - 11th December 2007 at 07:19.
    "If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte

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


    Did you find this post helpful? Yes | No

    Thumbs up

    Code:
            @ __CONFIG _XT_OSC & _LVP_OFF
            PORTB = 0
            TRISB = %11111110
    
    MAIN:
            TOGGLE PORTB.0
            PAUSE 200
            GOTO MAIN
    Presetting Configuration Fuses (PIC Defines) into your Program
    http://www.picbasic.co.uk/forum/showthread.php?t=543
    Steve

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

  11. #11
    Join Date
    Apr 2007
    Posts
    16


    Did you find this post helpful? Yes | No

    Default HPWM...error message?

    thank you all my pic worked well.

Similar Threads

  1. problem using GOSUB under interrupt
    By fobya71 in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 5th March 2010, 19:52
  2. PIC16F877A analog problem
    By DeViLa_Q8 in forum mel PIC BASIC
    Replies: 0
    Last Post: - 30th July 2009, 20:19
  3. USART Problem , but don't know where, in pc? or in PIC?
    By precision in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 15th July 2007, 08:12
  4. Hardware problem or what ?
    By Steve S. in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 4th March 2007, 21:39
  5. 1 slave 1 master 1 MAX232 1 problem ?
    By SuB-ZeRo in forum mel PIC BASIC Pro
    Replies: 19
    Last Post: - 31st July 2005, 22:59

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