PIC18s and Oscillator settings


Results 1 to 13 of 13

Threaded View

  1. #6
    Join Date
    Aug 2010
    Location
    Maryland, USA
    Posts
    869


    Did you find this post helpful? Yes | No

    Default Re: PIC18s and Oscillator settings

    PIC 18's are very popular, but they are a bit trickier to configure. Things to keep in mind:
    PBP OSC setting does NOT set up the pic for you. It is just for the compilier to know how to set the delays like pause, serin/serout, i2cread/write, and so forth. To get the PIC to run at the speed YOU want, you will have to read the oscillator section for the PIC you are using to see what bits need to be set in what registor. The 18's are more to learn then the 16's.
    There is no 1 answer for your question of how to set "it" up for 4mHz. We don't know what "it" is. We will help you, as dave is trying, but like Dave asked, what PIC are you using.

    As for your first question in your first post, the answer is this. The correct procedure is to understand the oscillator section of the datasheet for the PIC you want to use. Ask plenty of questions to help with that understanding. Blink an LED at some speed (I like 1/2 second on then off) to verify things are correct. When they are, everything else will be easy. Some folks like to use "hello world" from the comm port for this part, for me that is harder. With that all I know if its right or wrong. With the LED, I can tell if it's too fast or too slow also. I consider the LED a bit easier for me and people who don't do this stuff everyday. Heres my blink, works on EVERY 8 bit PIC so I never have to modify it:
    Code:
    main:
    high led
    pause 500
    low led
    pause 500
    goto main
    Of course LED needs to be set before hand.

    Posted at the same time, now I see the pic you have
    Last edited by cncmachineguy; - 1st October 2011 at 19:08. Reason: cross posted
    -Bert

    The glass is not half full or half empty, Its twice as big as needed for the job!

    http://foamcasualty.com/ - Warbird R/C scratch building with foam!

Members who have read this thread : 0

You do not have permission to view the list of names.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts