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

Can not change device 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
skywest



Joined: 16 Aug 2014
Posts: 7

View user's profile Send private message

Can not change device this far into the code
PostPosted: Sun May 13, 2018 10:15 am     Reply with quote

I am trying out some basic functions of CCS.
I want to do some RS232 comms and have just #included rs232.h and the compiler immediately throws up errors.
The first line in rs232.h is #device PIC18F4520 and throws the error "Can not change device this far into the code".
18f4520 is the device specified at project creation so I don't know why it thinks I'm trying to change it?

#include <TestSerial.h>
#include <rs232.h>

void main()
{

}
Ttelmah



Joined: 11 Mar 2010
Posts: 19504

View user's profile Send private message

PostPosted: Sun May 13, 2018 10:23 am     Reply with quote

Because 'testserial.h' is in front of it.....

The order needs to be:

Load the processor file. This sets the device.
Set the fuses.
Set the clock rate.
Then have the setups for things like serial and I2C.
Only then start actual 'code', including driver routines etc..

rs232.h is much too 'late' to be setting the device.
skywest



Joined: 16 Aug 2014
Posts: 7

View user's profile Send private message

PostPosted: Mon May 14, 2018 12:23 am     Reply with quote

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