View previous topic :: View next topic |
Author |
Message |
Boyce
Joined: 07 Feb 2010 Posts: 39
|
//Error 51"main.c" Line 27(0,1). A numeric express |
Posted: Sat Feb 20, 2010 10:26 pm |
|
|
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 |
|
![](templates/subSilver/images/spacer.gif) |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Sat Feb 20, 2010 11:20 pm |
|
|
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). |
|
![](templates/subSilver/images/spacer.gif) |
Boyce
Joined: 07 Feb 2010 Posts: 39
|
|
Posted: Sun Feb 21, 2010 1:16 am |
|
|
"...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 |
|
![](templates/subSilver/images/spacer.gif) |
|