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: 19515
Posted: Sun May 13, 2018 10:23 am
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.
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