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

Exception must point to constant

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



Joined: 14 Sep 2004
Posts: 2

View user's profile Send private message

Exception must point to constant
PostPosted: Tue Sep 14, 2004 9:08 am     Reply with quote

HI !

Im totaly new to pic programming. I wrote small program im CCS C and when i went on compile i get error : Expression must evulate to constant.
OK. I went into help and there was some example but not the solution.

The compiler is pointing to pic.h file and i can't find pic12xxx.h files in my
ccs dir. I dont now how to solve this......

If someone has some solution please write down.

Thanx in advance
Mark



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

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

PostPosted: Tue Sep 14, 2004 10:21 am     Reply with quote

You are posting in the wrong forum!
It might be helpful to actually post the code that is giving you a problem.
crni2004



Joined: 14 Sep 2004
Posts: 2

View user's profile Send private message

Example and wrong forum
PostPosted: Wed Sep 15, 2004 1:33 am     Reply with quote

Ok. Sorry for the forum... Where can i send such questions ?

2.) This is the test code from the microchip debounce.c that i want to test on pic12f675. The orginal hex file packed in example is working fine and i can burn him on chip but now i want to compile this example thru CCS C.

//****************************************************

#include "Debounce.h"
void main(void)
{
Init();
while(1)
{

if (!BUTTON) // sense BUTTON closure
{
ToggleLED();
Debounce();
}
}
}

//***********************************************************
void Init(void)
{
ANSEL = 0b00000000; // configure A/D inputs as digital I/O
TRISIO = D0_1Tris; // GPIO 3,4 outputs, GPIO 0,1,2,5,6,7 inputs
OPTION = 0b11010000; // Timer0 internal clock, 1:2 prescale
GPIO = D0On;
CMCON = 0b00000000; // configure comparator inputs as digital I/O
}

void ToggleLED(void)
{
if(LEDOn)
{
GPIO = D0Off;
}
else
{
GPIO = D0On;
}
}

//----------------------------------------------------
void Debonce(void)
{
unsigned char COUNT = TenMS;

TMR0 = 0;
for(;;)
{
if(!BUTTON)
{
// reset 10 millisecond COUNT if BUTTON pushed
COUNT = TenMS;
}
else
{
// decrement timer COUNT for every Timer0 overflow
if(T0IF)
{
// reset flag
T0IF = 0;

if(--COUNT == 0) break;
}
}
}
}
Guest








PostPosted: Wed Sep 15, 2004 11:17 am     Reply with quote

"and i can burn him" ??!! Programs and chips are women :-)
However, forget the "pic" preamble in file names. Just find "12F675.H" in the "Devices" directory.
Haplo



Joined: 06 Sep 2003
Posts: 659
Location: Sydney, Australia

View user's profile Send private message

PostPosted: Wed Sep 15, 2004 5:04 pm     Reply with quote

Anonymous wrote:
"and i can burn him" ??!! Programs and chips are women :-)


So you burn women? Very Happy

Anyway, at which line do you get that error?
Always post your code using the 'Code' buttons. We may need to look at the debounce.h too.
Mark



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

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

PostPosted: Wed Sep 15, 2004 6:27 pm     Reply with quote

My guess is that none of those registers are declared. The device is not specified. No #fuse statement. Debounce is mispelled ;) Take a look at some of the example programs to see how to set up the C file.
Guest








PostPosted: Thu Sep 16, 2004 2:08 am     Reply with quote

Ali,
programs and chips are women because of the phrase you often say when the program/chip not works as well as you intended ;-)
Guest








PostPosted: Thu Sep 16, 2004 2:57 am     Reply with quote

So you burn women
** ;-)) / what a conclusion :-)


OK. I can't start the debounce.c file so i went to another file called EX-8pin.c ( from the CCS example dir ). This file is using 12C508 header file. I'v started compile and all is working fine.
So, ok if i can't use microchip's examples i can use CCS eg.

Now, i'v changed the #include 12C508 to #include 12F675 and a get error "Unknown device type". The 12F675.h file was automaticly opened at line #device PIC12F675....
----------------------------------------------
1.)
I don't get it where is the problem. Basicly now i got the same stuff like in debounce.c file accept this one is i ccs c. I have selected the device from the tools / device selector

2.)
Im using the pickit flash starter kit for 8pins Microchip MCU's and JDM programmer for the rest.
What should i add accept :
"C:\Program Files\Microchip\PICkit\PICkit.exe"%H %D into
"device programmer" part so i can burn this compiled (i hope in future, working program ) to PIC12F675 ?

Stay cool
Haplo



Joined: 06 Sep 2003
Posts: 659
Location: Sydney, Australia

View user's profile Send private message

PostPosted: Thu Sep 16, 2004 3:41 am     Reply with quote

Anonymous wrote:
Ali,
programs and chips are women because of the phrase you often say when the program/chip not works as well as you intended ;-)


What?! You mean you shout "That's enough shopping for today!!" at your circuit?! Very Happy


Anyway I think I have figured out your problem. You see, 12C508 is a 12bit device and PCB is used for compiling its code. But You need to use PCM for 12F675. I think you are invoking the PCB compiler by mistake, and hence the error message.
Are you using PCW? If so, you can choose the compiler type from the drop-down box in the toolbar. Choose the compiler for 14-bit parts.

Look at this page for more information, B means PCB and M means PCM:
http://www.ccsinfo.com/devices.shtml
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