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

//Error 51"main.c" Line 27(0,1). A numeric express

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



Joined: 07 Feb 2010
Posts: 39

View user's profile Send private message

//Error 51"main.c" Line 27(0,1). A numeric express
PostPosted: Sat Feb 20, 2010 10:26 pm     Reply with quote

Code:
int16 Count;

void main()
{
   setup_adc_ports(NO_ANALOGS|VSS_VDD);
   setup_adc(ADC_CLOCK_DIV_2);
   setup_spi(SPI_SS_DISABLED);
   setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
   setup_timer_1 (T1_INTERNAL | T1_DIV_BY_8);
   setup_timer_2(T2_DISABLED,0,1);
   setup_comparator(NC_NC_NC_NC);// This device COMP currently not supported by the PICWizard
//Setup_Oscillator parameter not selected from Intr Oscillator Config tab

   // TODO: USER CODE!!
   enable_interrupts(INT_TIMER1);
   enable_interrupts(GLOBAL);

//*****************************************************   
  //Error 51"main.c" Line 27(0,1). A numeric expression must appear here
//*****************************************************

#INT_TIMER1
 void TIMER1_isr()
   {
      Count++;
      clear_interrupt(int_timer1);
      if(Count >=5,000) Count=0;
   }

   while(TRUE)


The error:
Error 51"main.c" Line 27(0,1). A numeric expression must appear here

occurs after:
enable_interrupts(GLOBAL);

in the code above.

I can find no guidance on how to clear the error.
Thanks,
Boyce
_________________
boyceg1@gmail.com
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Sat Feb 20, 2010 11:20 pm     Reply with quote

I'm not sure if you're showing code fragments or if that is the code, but
you cannot put an interrupt routine (or any other routine) inside main()
or any other function.

If that's not the problem, then post your PIC and compiler version
(and revised code).
Boyce



Joined: 07 Feb 2010
Posts: 39

View user's profile Send private message

PostPosted: Sun Feb 21, 2010 1:16 am     Reply with quote

"...you cannot put an interrupt routine (or any other routine) inside main()
or any other function."

Thought I had tried moving the routine outside of main, but I guess I didn't.

Now that the routine is moved, the program compiles.

Thanks for the prompt reply.
Boyce
_________________
boyceg1@gmail.com
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