Forcing device type


Closed Thread
Results 1 to 7 of 7
  1. #1
    Join Date
    Sep 2005
    Location
    Campbell, CA
    Posts
    1,107

    Default Forcing device type

    I usually work with 18F8722's, but recently I have been using some other varieties. I spent quite a while this afternoon beating my head against the wall until I realized that I was compiling for the wrong chip type.
    The "bogus" file compiled with no errors.

    I'm using CodeStudio.

    My question is: Can I put some sort of directive in my PBP header that has a device type - something that will flag an error if I don't have the correct device type set in CS+?
    Charles Linquist

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


    Did you find this post helpful? Yes | No

    Default

    You might try...
    Code:
    ASM
        ifndef __18F8722
            error "18F8722 not selected"
        endif
    ENDASM
    That's 2 underscores before the 18F.
    DT

  3. #3
    Join Date
    Sep 2005
    Location
    Campbell, CA
    Posts
    1,107


    Did you find this post helpful? Yes | No

    Default

    Works!

    Thanks!
    Charles Linquist

  4. #4
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default Will that work. . . .

    Quote Originally Posted by Darrel Taylor View Post
    You might try...
    Code:
    ASM
        ifndef __18F8722
            error "18F8722 not selected"
        endif
    ENDASM
    That's 2 underscores before the 18F.
    Hi Darrel,
    Will that work for any PIC?
    I have been tripped up that way too.
    JS
    edit: Oh yes it does . . . very cool Master Darrel, this unworthy grasshopper thanks you again!
    Last edited by Archangel; - 18th April 2007 at 06:03.
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Joe S. View Post
    Will that work for any PIC? ...
    edit: Oh yes it does . . .
    Yes it does!

    Well, assuming you're using MPASM.
    With Charles' 18F8722 it was a good bet.

    But if you're using PM.exe with the "Lower" chips, it would look like this...
    Code:
    ASM
        ifndef pic16F877A
            "pic16f877a not selected"
        endif
    ENDASM
    HTH,
    DT

  6. #6
    Join Date
    Feb 2005
    Location
    Kolkata-India
    Posts
    563


    Did you find this post helpful? Yes | No

    Thumbs up Thanks Darrel

    Hi,

    I always comment my code as to which PIC I am using. Cause I forget and MCS too. This handy piece of code is really helpful. Thanks again to Charles and Darrel.
    Regards

    Sougata

  7. #7
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,648


    Did you find this post helpful? Yes | No

    Question one step further ...

    Hi, Picmen

    Does anybody know how to define wich is the PIC from the source listing ???

    ( to avoid having to use " CONFIGURE/Select device " manually in MPLAB or MPASM )

    That's the only point I didn't solve ... others work well !!!

    Ok, I know works without changing "select device" for "similar architecture" PICs ... i.e 12F629and 12F675 ... or 16F628 and 16F648.

    but what doable for 16F84 and 16F88, i.e ???

    Thanks

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

Similar Threads

  1. Watchdog Timers
    By Squibcakes in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 27th August 2014, 18:03
  2. RF Modules
    By tonyfelloni in forum mel PIC BASIC Pro
    Replies: 44
    Last Post: - 26th June 2010, 17:42
  3. SEROUT is not working!
    By jhorsburgh in forum General
    Replies: 9
    Last Post: - 3rd September 2008, 12:58
  4. Target device <> Selected Device????
    By deepgfishing in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 20th June 2007, 21:18
  5. @ Device Parameters
    By Randy_Suwanee in forum General
    Replies: 2
    Last Post: - 11th August 2004, 14:40

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