PIC12F675 at 20MHz ?? (Pic Basic Pro Compiler)


+ Reply to Thread
Results 1 to 13 of 13
  1. #1
    Join Date
    Feb 2022
    Posts
    51

    Default PIC12F675 at 20MHz ?? (Pic Basic Pro Compiler)

    Good evening to the community.

    PIC12F675 is not planned to operate with an external quartz.
    It does not have pin dedicated to an external quartz.
    The Datasheet specifies, however, that this little peak can work at 20mHz!?

    So, is it enough to use the DEFINE OSC 20 command to operate at 20mHz ??

    Indeed, the Picbasic Pro Compiler manual specifies this (§2,3,1): [Note that" DEFINE OSC "does not fix or does not change the real clock frequency! He only indicates to PBP what he should expect.
    The actual frequency is defined by choosing a crystal, by changing the configuration of the device, by defining registers in your program, or (most often) a combination of all this.]

    But the PIC 12F675 has no pins specifically provided for such an external quartz!?

    So how actually run a PIC12F675 in 20mHz and which programming lines should be put in a BasicPro Compiler program?

    Thanks for your help.

  2. #2
    Join Date
    Apr 2014
    Location
    OK
    Posts
    557


    Did you find this post helpful? Yes | No

    Default Re: PIC12F675 at 20MHz ?? (Pic Basic Pro Compiler)

    Just looked at the Data Sheet, and best I can tell, it only offers one speed; 4 MHz.

  3. #3
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,807


    Did you find this post helpful? Yes | No

    Default Re: PIC12F675 at 20MHz ?? (Pic Basic Pro Compiler)

    The internal oscillator is set at 4MHz. But if you want 20MHz, then you need to sacrifice two pins, GPIO4 and GPIO5 to be used as Crystal connections for the High Speed oscillator.

    Or you can drive the GPIO5 pin with an external can oscillator. See page 53 of the datasheet.

    The settings for all above is in the CONFIG word during programming of the chip (page 52 of the datasheet).

    Ioannis

  4. #4
    Join Date
    Feb 2022
    Posts
    51


    Did you find this post helpful? Yes | No

    Default Re: PIC12F675 at 20MHz ?? (Pic Basic Pro Compiler)

    Hi ioannis.
    Ok, well seen.
    The internal oscillator being 4MHz and if we want to work with a definition at 20mHz, an external quartz is then necessary.
    This one connecting to GPIO4 and GPIO5 ... which are indeed well provided for this use!
    Which had actually escaped me. (
    I will review my program by considering this precious information.
    Thank you again and have a good week everyone!

  5. #5
    Join Date
    Feb 2022
    Posts
    51


    Did you find this post helpful? Yes | No

    Default Re: PIC12F675 at 20MHz ?? (Pic Basic Pro Compiler)

    So, I then have a few questions left about this command define OSC:

    1_The "DEFINE OSC 20" command would only make sense if you really use a 20mHz quartz?

    2_With a 20mHz quartz, is the simple fact of configuring the fuse "OSC HS" sufficient? Or will we also have to add the DEFINE OSC 20 command in the program?

    3_ The fact that the manual specifies that the DEFINE command can be used to change the predefined value of the oscillator makes you think that it is not necessary to use a quartz to actually work at 20mHz ...

    4_ Without Quartz What would the impact of the DEFINE OSC 20 order? The timing unit for Pulsin, Pulsout and Pause commands would still be modified?


    Thanks

  6. #6
    Join Date
    Aug 2011
    Posts
    412


    Did you find this post helpful? Yes | No

    Default Re: PIC12F675 at 20MHz ?? (Pic Basic Pro Compiler)

    The ONLY thing the DEFINE OSC command does is inform the compiler what clock speed you're running at so it can adjust various internal timings.

    It's completely up to you to set the CONFIG and any runtime settings (OSCCON, etc) that may be required to get you that speed.

  7. #7
    Join Date
    May 2013
    Location
    australia
    Posts
    2,389


    Did you find this post helpful? Yes | No

    Default Re: PIC12F675 at 20MHz ?? (Pic Basic Pro Compiler)

    there is a manual that answers just about every question available here


    eg
    4_ Without Quartz What would the impact of the DEFINE OSC 20 order? The timing unit for Pulsin, Pulsout and Pause commands would still be modified?
    Name:  zorb.jpg
Views: 779
Size:  216.5 KB
    Warning I'm not a teacher

  8. #8
    Join Date
    Feb 2022
    Posts
    51


    Did you find this post helpful? Yes | No

    Default Re: PIC12F675 at 20MHz ?? (Pic Basic Pro Compiler)

    OK.
    If I note that: “Since Defining an OSC value has no effect on PULSIN. The resolution always changes with the actual oscillator speed.”

    What then is the true usefulness of this DEFINE OSC command?

    Simply or imperatively specify in the PBP compiler the actual operating speed depending on a quartz or simply the internal oscillator.

    The only configuration of the OSC fuse bits would not be enough?

    I would then deduce that this command must always be placed in the program to specify the actual operating speed at PBP. Correct ?

  9. #9
    Join Date
    May 2013
    Location
    australia
    Posts
    2,389


    Did you find this post helpful? Yes | No

    Default Re: PIC12F675 at 20MHz ?? (Pic Basic Pro Compiler)

    What then is the true usefulness of this DEFINE OSC command?
    its not a command, its a compiler directive

    as pointed out it is used to:-
    inform the compiler what clock speed you're running at so it can adjust various internal timings. that's it nothing else

    do read the manual there is a chapter on define OSC
    pause command for instance
    DEFINE OSC must be used in order for PBP to accurately calculate and generate code for PAUSE. If no DEFINE OSC is placed in the program, PBP will assume that the system clock will operate at 4MHz and calibrate the generated code accordingly.
    Warning I'm not a teacher

  10. #10
    Join Date
    Feb 2022
    Posts
    51


    Did you find this post helpful? Yes | No

    Default Re: PIC12F675 at 20MHz ?? (Pic Basic Pro Compiler)

    OK .
    Well understood that it is not an command but a directive for the compiler.
    I will assimilate all of this !
    Thank you very much for these precious essential information.

  11. #11
    Join Date
    Apr 2014
    Location
    OK
    Posts
    557


    Did you find this post helpful? Yes | No

    Default Re: PIC12F675 at 20MHz ?? (Pic Basic Pro Compiler)

    Just a thought, since you're using an 8-pin PIC, look at the PIC16F18313. It offers a bunch of features and is probably cheaper than what you're using (unless you have a couple hundred on the shelf already). It can clock up to 32 MHz internally.

  12. #12
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    3,807


    Did you find this post helpful? Yes | No

    Default Re: PIC12F675 at 20MHz ?? (Pic Basic Pro Compiler)

    zorgloub needs a lot of reading and experimenting to manage a more complicated chip. Lacks understanding of basics...

    Me too, have to say

    Ioannis

  13. #13
    Join Date
    Feb 2022
    Posts
    51


    Did you find this post helpful? Yes | No

    Default Re: PIC12F675 at 20MHz ?? (Pic Basic Pro Compiler)

    Indeed, in all modesty, it must be recognized.
    I am rather a little Picaxe user after starting to "play" with Basic Stamp.
    I now try to convert my "simple" Picaxe programs with PBP to place it in a slightly cheaper peak.
    Thank you, in any case, for the help provided here on this forum with sereinity, patience and competence!
    Good night all.

Similar Threads

  1. Pic Basic Compiler
    By engr_israr40 in forum General
    Replies: 5
    Last Post: - 29th April 2007, 15:33
  2. PIC BASIC Compiler pbc:- Help!
    By timmoore47 in forum mel PIC BASIC
    Replies: 5
    Last Post: - 5th February 2007, 16:58
  3. Replies: 5
    Last Post: - 17th January 2006, 19:26
  4. PIC Basic Pro Compiler
    By iclok in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 25th November 2005, 03:22
  5. How to learn PIC BASIC compiler in 7 days?
    By luqman83salleh in forum General
    Replies: 2
    Last Post: - 13th August 2004, 14:15

Members who have read this thread : 12

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