View previous topic :: View next topic |
Author |
Message |
pkwek
Joined: 26 Mar 2004 Posts: 3
|
#device error when compile for PCWH ver 3.185 |
Posted: Fri Mar 26, 2004 2:59 am |
|
|
Hi,
Alway encounter this error when doing pre-processor setting.
codes:
#if defined(__PCH__)
#include (18F8620.h)
#endif
#device adc=10 <-- A #device is required before this line
or
void main() <-- A #device is required before this line
(actually, it happens to any statement that is planted here)
Any advise? :sad: |
|
![](templates/subSilver/images/spacer.gif) |
ckielstra
Joined: 18 Mar 2004 Posts: 3680 Location: The Netherlands
|
|
Posted: Fri Mar 26, 2004 3:46 am |
|
|
One of the first lines in your code needs to be
#device PIC18F8620
All other #device lines without the type number in it just add up to the already existing define.
Obviously your __PCH__ is not defined!
I can tell this from the next line containing an error and your compiler not complaining.
Quote: | #include (18F8620.h)
|
This is gramatically wrong, replace the '()' by '<>':
#include <18F8620.h>
Why don't you just leave the test for __PCH__ anyway? You allways need to include the 18F8620.h
Example:
// My example prog
#include <18F8620.h>
#device adc=10
void main()
{
} |
|
![](templates/subSilver/images/spacer.gif) |
pkwek
Joined: 26 Mar 2004 Posts: 3
|
Still not working. |
Posted: Sun Mar 28, 2004 7:47 pm |
|
|
Thanx for the reply for the problem!
I have changed the codes to
#include <18F8620.h>
#device adc=10
void main ()
{}
But when i compile, 18F8620.h opens up and shows this error:
unknown device type try --PCH
:sad: How? |
|
![](templates/subSilver/images/spacer.gif) |
dyeatman
Joined: 06 Sep 2003 Posts: 1924 Location: Norman, OK
|
Use Compiler Select |
Posted: Sun Mar 28, 2004 8:05 pm |
|
|
If you are using PCWH then you need to change from 14 bit device to 16 bit device on the menu bar. If the option is not showing you have to right click on the blank area of the menu bar, choose Customize and add the Compiler Select menu bar.
Dave |
|
![](templates/subSilver/images/spacer.gif) |
pkwek
Joined: 26 Mar 2004 Posts: 3
|
|
Posted: Sun Mar 28, 2004 9:15 pm |
|
|
Thanx!
Everything's ok when i set the compiler select menu to MicroChip PIC18!!!
Earlier on, this compiler select menu was not on the toolbar.
Ready caught me. Thought it was already selected proper. I was working on PIC16 previously.
Thanx man! :grin: |
|
![](templates/subSilver/images/spacer.gif) |
|