Menu

Beginner Question

Help
2007-04-01
2013-05-30
  • Nobody/Anonymous

    Hello!

    I am a complete beginner to PIC's.

    I just wrote my first program and downloaded it to the Pic (JDM).
    Everything worked well except nothing happens when I run it.
    The program just turns a few pins on.
    I have nothing connected to the Oscillator pins. I do not quite get what to do with them.
    Do I have to get a external oscillator and if so which one?

    I have connected VDD +5V and VSS to negative and MCRL thru a 4.7K to VDD.
    The chip is a PIC16F876/20SP.
    Here is the program:

    'Chip model
    #chip 16F876, 20

    'Set the pin directions
    dir PORTB.1 out
    dir PORTB.2 out
    dir PORTB.4 out
    dir PORTB.5 out

    ADOff

    'Main routine
    Start:
      SET PORTB.1 ON
      SET PORTB.2 ON
      SET PORTB.4 ON
      SET PORTB.5 ON

    'Jump back to the start of the program
    goto Start

     
    • Hugh Considine

      Hugh Considine - 2007-04-01

      The 16F876 requires an external oscillator. I normally use this circuit:

      http://gcbasic.sourceforge.net/osc.jpg

      It's okay to vary the capacitor values a little, I've also used 10 and 22 pf ones without trouble. According to the datasheet the resistor is optional, but I always include it anyway.

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.