![](templates/subSilver/images/CCSLogo.jpg) |
![CCS C Software and Maintenance Offers](templates/subSilver/images/forumAd6.jpg) |
View previous topic :: View next topic |
Author |
Message |
asmboy
Joined: 20 Nov 2007 Posts: 2128 Location: albany ny
|
kinda confused about the #DEVICE statement |
Posted: Wed May 14, 2008 5:22 pm |
|
|
I need to tell my 16F886 that i want to read 10 bit data - as the default is to report the ADC at only 8 of its 10 native bits
so i added the #device statement at the head of a program that uses the ADC to tell it use adc=10 bits
problem is that no matter how i try to do it my
ver 4.066 compiler says
" cannot change device this far into program "
at line #2 - first compiled line ???
?
( i have stripped ALL the rest of the code - to make is show more clearly and heres is the smallest fragment that shows the problem )
If i comment out the #device line - the rest of the rather extensive program this frag is lifted from - works fine what the HECK is this dumb guy doing wrong with the #device statement ???
not being able to switch on 10 bit adc reading is killing me
//
#device PIC16F886 *=16 ADC=10
#include <16f886.h>
#include <stdlib.h>
#FUSES NOPROTECT,INTRC,NOWDT,NOMCLR,NODEBUG,NOLVP,NOIESO,NOFCMEN,PUT,NOWRT,NOFCMEN,NOBROWNOUT
main() {
for (;;) {
}
} |
|
![](templates/subSilver/images/spacer.gif) |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Wed May 14, 2008 5:28 pm |
|
|
Do it like this, in this order:
Quote: | #include <16F886.h>
#device *=16 ADC=10
#FUSES NOPROTECT,INTRC,NOWDT,NOMCLR,NODEBUG,NOLVP, etc.
#include <stdlib.h> |
|
|
![](templates/subSilver/images/spacer.gif) |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|