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 support@ccsinfo.com

PIC18F4580 Standart Header File Error 23

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



Joined: 23 Jun 2005
Posts: 1
Location: Austria

View user's profile Send private message Visit poster's website

PIC18F4580 Standart Header File Error 23
PostPosted: Thu Jun 23, 2005 3:35 am     Reply with quote

Hello!

I'm starting now with a new project and the PIC18F4580.

When I'm compiling my project, the compiler stops with an strange (for me) error.

These are the first 2 lines in 18F4580.h:
//////// Standard Header file for the PIC18F4580 device ////////////////
#device PIC18F4580

But this #device causes the error: "Can not change device type this far into the code"

Can anyone help with my problem?

Thanks for answers.

Robert
Ttelmah
Guest







PostPosted: Thu Jun 23, 2005 4:19 am     Reply with quote

The problem is not in the 18F4580.h file, but in your _main_ file.
Basically, the top lines of the main should look something like:

#include <18f4580.h>
#include <stdio.h>
#include....

etc..

Note that the 18F4580 file is the _first_ file included.
If you use the wizard, and it sets up a project 'include' file, then this must be the first file included, and the 18F4580.h file, must be included as the first line in this file.
The error you have, will occur is (for instance), you have:

#device PIC18F4580
#include <stdio.h>
#include <18F4580.h>

This shows two seperate faults that will cause the problem. The first is putting a seperate #device statement (don't - just rely on the one in the processors 'include' file), and the second is putting another include file in front of the processor definition file.

Best Wishes
psycho
Guest







Hello. can anyone have the pic18f4580 library ?
PostPosted: Tue Jan 24, 2006 2:55 am     Reply with quote

Ttelmah wrote:
The problem is not in the 18F4580.h file, but in your _main_ file.
Basically, the top lines of the main should look something like:

#include <18f4580.h>
#include <stdio.h>
#include....

etc..

Note that the 18F4580 file is the _first_ file included.
If you use the wizard, and it sets up a project 'include' file, then this must be the first file included, and the 18F4580.h file, must be included as the first line in this file.
The error you have, will occur is (for instance), you have:

#device PIC18F4580
#include <stdio.h>
#include <18F4580.h>

This shows two seperate faults that will cause the problem. The first is putting a seperate #device statement (don't - just rely on the one in the processors 'include' file), and the second is putting another include file in front of the processor definition file.

Best Wishes
Rolling Eyes Rolling Eyes Rolling Eyes Embarassed Embarassed
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