CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

PCD: Can not change device type this far into the code

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
mfroncillo



Joined: 26 Aug 2009
Posts: 2

View user's profile Send private message

PCD: Can not change device type this far into the code
PostPosted: Wed Aug 26, 2009 10:37 am     Reply with quote

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

View user's profile Send private message

PostPosted: Wed Aug 26, 2009 11:44 am     Reply with quote

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

View user's profile Send private message

solved
PostPosted: Wed Aug 26, 2009 12:07 pm     Reply with quote

that did it. thanks
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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