PIC External or Internal Clock

Discussion in 'Embedded Systems and Microcontrollers' started by JDR04, Jun 13, 2013.

  1. JDR04

    Thread Starter Active Member

    May 5, 2011
    339
    4
    Hi everyone. I'm using a PIC16F690 and have a simple program that flashes two LED's alternatively.

    At the moment the PIC is plugged into a low pin count demo board and is programmed with the PICKit2 programmer.

    My program is done with FLOWCODE 5 and works great.

    What I want to know is how to run the PIC in its own circuit without the PICKit2 programmer or low pin count demo board. I think the PIC is currently being run by an internal clock, and can I also use it independantly from the programmer etc???

    I'm totally new to this and would appreciate any help.
    Thanks a lot-JDR04
     
    Last edited: Jun 13, 2013
  2. tshuck

    Well-Known Member

    Oct 18, 2012
    3,531
    675
    I'm not entirely sure what you are asking.
    Do you mean to ask if the microcontroller can be run off of its internal oscillator? If so, yes, it can. How you'd configure that with FLOWCODE, I'm not sure...

    Or, do you mean to ask if you can use the PIC without the demo board/pickit connection? Again, yes, you can.
     
    JDR04 likes this.
  3. JDR04

    Thread Starter Active Member

    May 5, 2011
    339
    4
    Thanks tshuck. Would you be able to explain to me how I can run the PIC without the PICKit2 conection.

    Thanks again JDR04
     
  4. tshuck

    Well-Known Member

    Oct 18, 2012
    3,531
    675
    Well, one thing people usually miss when starting out is the MCLR. This is a reset that can be disabled (see "Configuration Words "), and is typically associated with an input only pin. A pull-up resistor will allow your PIC to run. 10k is my typical value pull-up.

    Next, you need to set the oscillator configuration in the configuration word(s). See page 201 and following, in the datasheet (from Microchip), for the configuration bits and what they do.

    After that, you weep probably want to disable the watchdog timer, also configuration word.

    Once that is done, you will probably want to set the internal oscillator to a specific frequency; use the OSCCON register for this.

    You should also put a ~100uF cap across the supply pins as close to the PIC as reasonable.
     
    JDR04 likes this.
  5. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,388
    1,605
    One thing I don't see mentioned is POWER. What's going to power your PIC without a PICkit?

    5 volts is nominal, 4.5 volts is acceptable, so you could use 3 batteries in series.
     
    JDR04 likes this.
  6. t06afre

    AAC Fanatic!

    May 11, 2009
    5,939
    1,222
    [​IMG]
    On your board. You can solder a power source to the P2 connector. If you have some old cell-phone charger. This may be used. As long as it is labeled with an output voltage in range 4 to 5 volt
     
    JDR04 likes this.
Loading...