Define osc 8 not working on 12f683 - wondering if Its related to include files?


Closed Thread
Results 1 to 11 of 11

Hybrid View

  1. #1
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,610


    Did you find this post helpful? Yes | No

    Default Re: Define osc 8 not working on 12f683 - wondering if Its related to include files?

    Hi,
    Actually, you can change the way MCSP formats the code by going to View -> Editor Options -> Highlighter but that can be a bit misleading because it's actually only how MCSP displays the code on the screen IN MSCP, if you open the code in Notepad or whatever it'll be exactly as you typed it - something to watch out for in other words.

    If you look at section 2.3.3 in the PBP3 manual you'll find
    For the user familiar with Assembly Language, the major clue to understanding is that DEFINEs in PBP are converted literally to Assembly Language #DEFINE directives.
    For the practical PBP user, there are a couple of fundamental points to consider:
    1) DEFINEs are CASE SENSITIVE!
    2) Specific DEFINEs are generally associated with PBP commands. The command pages will describe how the relevant DEFINEs affect the operation of each command.
    This has been covered multiple times in the forum but again, the word define is a PBP command/keyword and PBP is not case sensitive so it can be either case DEFine, defINe, DEFINE, define, doesn't matter. What comes AFTER DeFiNe is passed directly the assembler and the assembler (MPASM) IS case sensitive. PBP's library routines are written in assembly and uses the OSC setting/value/variable/definition/whatever to calculate software delays, baudrates etc etc etc. So when you need to tell the compiler that you're using another oscillator frequency you need to define OSC not osc or Osc, they are three different things and the library routines only know about OSC - not osc or Osc.

    /Henrik.

  2. #2
    Join Date
    Sep 2010
    Location
    Las Vegas, NV
    Posts
    305


    Did you find this post helpful? Yes | No

    Default Re: Define osc 8 not working on 12f683 - wondering if Its related to include files?

    As many times as this DEFINE in particular gets brought up you'd think MeLabs would at least give you an error during compile if the two defines XXX don't match. Seems like it should generate some kind of error.

  3. #3
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default Re: Define osc 8 not working on 12f683 - wondering if Its related to include files?

    You can DEFINE anything you want for use with your assembly language routines.
    PBP has no way to know if you are using 'osc' in your routines, or if you didn't capitalize 'OSC' for PBP.

    It is unfortunately up to you to get it right.
    DT

  4. #4
    Join Date
    Sep 2010
    Location
    Las Vegas, NV
    Posts
    305


    Did you find this post helpful? Yes | No

    Default Re: Define osc 8 not working on 12f683 - wondering if Its related to include files?

    Never good to rely on lowest common denominator. That reliance means this thread will be recreated many more times.

  5. #5
    Join Date
    Jan 2007
    Posts
    78


    Did you find this post helpful? Yes | No

    Default Re: Define osc 8 not working on 12f683 - wondering if Its related to include files?

    Henrik was right in his original post on this.
    It just occurred to me ***DUH*** that just because the editor automatically makes "define" into lower case, doesn't mean the OSC is supposed to be lower case as well.

    With MicroCode Studio the only syntax that works is "define OSC 8"

    Nice to have the 8mhz clock running for more fun experiments.
    BTW:
    I just got a couple 18F2550 chips.
    Looking forward to playing with them!!! :-]

Similar Threads

  1. where to put include files
    By queenidog in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 21st February 2013, 19:10
  2. Post your INCLUDE files here
    By mackrackit in forum Code Examples
    Replies: 4
    Last Post: - 16th September 2011, 23:50
  3. Where are all the INCLUDE files??
    By Heckler in forum General
    Replies: 3
    Last Post: - 13th September 2011, 08:27
  4. Include Files for some Routines
    By rsocor01 in forum PBP Wish List
    Replies: 2
    Last Post: - 23rd April 2010, 19:13
  5. Define Osc Not Working
    By BobEdge in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 23rd February 2005, 11:23

Members who have read this thread : 0

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