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

CCS Compilation Problem

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



Joined: 17 Mar 2005
Posts: 1

View user's profile Send private message

CCS Compilation Problem
PostPosted: Thu Mar 17, 2005 3:53 pm     Reply with quote

Hai
I am Newbie trying to use CCS compiler along with MP Lab 5.7. When I add #include<16f876.h>, I am getting an error during the compilation saying duplicate define. The error is as fallows

Command line: "C:\PROGRA~1\PICC\CCSC.EXE +FM C:\HOBBY\PICFIL~1\CCSCOM~1\ADC\VOLT_ADC.C"
Error[125] C:\Program Files\PICC\Examples\16f876.h 37 : Duplicate #define


If I don't include the header file, all the varibles defined in C:\Program Files\PICC\Examples\16f876.h are comes up with errors as they are not defined. So waht I did was don't include header file and re-declare all req. variables.

The new problem is with using output_c( ) function. Error says Undefined identifier. Can any one help me to get out of this problem please Question
I had PCM V2.705 (PCW compiler IDE V2.15) installed and compile file inside MP Lab environment. The CCS tool suite aslo appears installed in MP Lab.
Thanks
Ttelmah
Guest







PostPosted: Thu Mar 17, 2005 4:52 pm     Reply with quote

The #include should be the very first line of your program. You should also not have your own #device statement (it is in the file), except to set the ADC, and pointer length values. If you are setting these, it should be added as the line immediately after the #include. So for example, the following would be the typical first two lines of a 16F876 project:
Code:

#INCLUDE   <16F877.H>
#DEVICE   *=16 ADC=10

output_c, should work, _unless_ you have enabled case significance with the #case operator. If so, all the CCS functions are upper case, and must be typed as such.

Best Wishes
Mark



Joined: 07 Sep 2003
Posts: 2838
Location: Atlanta, GA

View user's profile Send private message Send e-mail

PostPosted: Thu Mar 17, 2005 5:26 pm     Reply with quote

Ttelmah wrote:
The #include should be the very first line of your program. You should also not have your own #device statement (it is in the file), except to set the ADC, and pointer length values. If you are setting these, it should be added as the line immediately after the #include. So for example, the following would be the typical first two lines of a 16F876 project:
Code:

#INCLUDE   <16F877.H>
#DEVICE   *=16 ADC=10

output_c, should work, _unless_ you have enabled case significance with the #case operator. If so, all the CCS functions are upper case, and must be typed as such.

Best Wishes

I use case and always do ccs functions in lower case.
Guest








PostPosted: Thu Mar 17, 2005 7:16 pm     Reply with quote

Hai,
Here is my error message for output_c( );

Building VOLT_ADC.HEX...

Compiling VOLT_ADC.C:
Command line: "C:\PROGRA~1\PICC\CCSC.EXE +FM C:\HOBBY\PICFIL~1\CCSCOM~1\ADC\VOLT_ADC.C"
Error[52] C:\Program Files\PICC\Examples\16f876.h 69 : Undefined identifier

MPLAB is unable to find output file "VOLT_ADC.HEX". This may be due to a compile, assemble, or link process failure.

Build failed.


Statements I used are
set_tris_c(0x00);
output_c(0xff);


I also used the same lines said in the previous post
Question
Question
Mark



Joined: 07 Sep 2003
Posts: 2838
Location: Atlanta, GA

View user's profile Send private message Send e-mail

PostPosted: Thu Mar 17, 2005 9:23 pm     Reply with quote

Look at line 69 of 16f876.h
dyeatman



Joined: 06 Sep 2003
Posts: 1933
Location: Norman, OK

View user's profile Send private message

PostPosted: Thu Mar 17, 2005 9:53 pm     Reply with quote

According to my info the function output_c() was not supported in that version. That is why it is "undefined" . That function was added in version 3 sometime I believe...

Many of the functions defined in the current manual are not available back in version 2. Look in a version 2 manual or the help file.
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Mar 17, 2005 10:08 pm     Reply with quote

Hi Dave, you beat me to it, while I was typing in my post, but
since I put so much time into it, I'll post it anyway. Mr. Green

Quote:
I had PCM V2.705

That version of the compiler came out in the early part of 2000.
It doesn't support the output_c() function.

You're probably looking at the modern compiler manual that you got
from the CCS website. It's not going to be accurate for your version.
This page is from the CCS website in April 2000. It shows the
functions that are likely supported by your version:
http://web.archive.org/web/20000325043631/ccsinfo.com/picc.html

There is a work-around for your problem. You can define a macro
which will do the same thing as the modern CCS function. See
the statements shown in bold, below:

#include <16F876.H>
#fuses XT, NOWDT, NOPROTECT, BROWNOUT, PUT, NOLVP
#use delay(clock = 4000000)

// Add the following two lines:
#byte port_c = 7
#define output_c(value) set_tris_c(0x00); port_c = (value)

main()
{

// Now you have an output_c() function:
output_c(0xff);

while(1);
}

Your other problem is the one where the compiler reports an error in
a .H file but the error is really in the .C source file. That problem
occurred in compiler versions around that era. It was due to some
strange interaction with MPLAB.
For more information on it, go to this thread from the old CCS board.
Stefan Daystrom has some good notes on how to prevent it.
http://www.pic-c.com/forum/old/messages/134.html
dyeatman



Joined: 06 Sep 2003
Posts: 1933
Location: Norman, OK

View user's profile Send private message

PostPosted: Thu Mar 17, 2005 10:15 pm     Reply with quote

Hi PCM,
Thats OK, your answer was much better than mine!

Dave
Guest








PostPosted: Fri Mar 18, 2005 7:34 pm     Reply with quote

Thanks that worked out with out any problem

Is there any way i could get old manual from the web

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