|
|
View previous topic :: View next topic |
Author |
Message |
mfroncillo
Joined: 26 Aug 2009 Posts: 2
|
PCD: Can not change device type this far into the code |
Posted: Wed Aug 26, 2009 10:37 am |
|
|
Hello,
I am receiving the following error while compiling:
Error 23: Can not change device type this far into the code.
The error arrow points to the line "#device *= 16" in the following code:
Code: |
#include <30f5011.h>
#include <DS1631.c>
#device *=16
#device ICD=true
#fuses EC, NOWDT
#use delay(clock=40000000)
#use rs232 (FORCE_sw, baud=9600, parity=N, xmit=pin_F5, rcv=pin_F4, INVERT)
void main() {
BYTE value;
init_temp();
do {
value = read_temp();
printf("%u\r\n",value);
delay_ms(1000);
} while (TRUE);
} |
I have not changed the 30f5011.h file.
Also, I have checked the forums for this error and it seems to occur when someone redefines the header file which I have not done here.
This error first appeared when I added the following test code from the CCS examples:
Code: |
//// ////
//// This driver returns a high resolution value. For lower ////
//// resolutions use the DS1621.C driver as it is compatible with ////
//// the DS1631. ////
|
++++++++++++++++++
Code deleted.
Reason: Forum Rule #10
10. Don't post the CCS example code or drivers
-- Forum Moderator
++++++++++++++++++
Any ideas? Thanks in advance. |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Wed Aug 26, 2009 11:44 am |
|
|
In CCS, don't put #include files before #device statements.
Move the line in bold so it's below all the other lines shown here:
Quote: | #include <30f5011.h>
#include <DS1631.c>
#device *=16
#device ICD=true
#fuses EC, NOWDT
#use delay(clock=40000000)
#use rs232 (FORCE_sw, baud=9600, parity=N, xmit=pin_F5, rcv=pin_F4, INVERT) |
Also, the #device *=16 is only used with the PCM compiler (16F877, etc.).
It's not needed on 18F, 24F, dsPIC, etc. Delete that line. |
|
|
mfroncillo
Joined: 26 Aug 2009 Posts: 2
|
solved |
Posted: Wed Aug 26, 2009 12:07 pm |
|
|
that did it. thanks |
|
|
|
|
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
|