View Full Version : Forcing device type
Charles Linquis
- 18th April 2007, 02:26
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+?
Darrel Taylor
- 18th April 2007, 02:48
You might try...
ASM
ifndef __18F8722
error "18F8722 not selected"
endif
ENDASMThat's 2 underscores before the 18F.
Charles Linquis
- 18th April 2007, 02:58
Works!
Thanks!
Archangel
- 18th April 2007, 06:00
You might try...
ASM
ifndef __18F8722
error "18F8722 not selected"
endif
ENDASMThat'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!
Darrel Taylor
- 18th April 2007, 08:03
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...
ASM
ifndef pic16F877A
"pic16f877a not selected"
endif
ENDASM
HTH,
sougata
- 18th April 2007, 11:21
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.
Acetronics2
- 18th April 2007, 14:26
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
Powered by vBulletin® Version 4.1.7 Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.