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

Error#51 A numeric expression must appear here

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



Joined: 23 Mar 2010
Posts: 43

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

Error#51 A numeric expression must appear here
PostPosted: Tue Jul 08, 2025 2:58 am     Reply with quote

hi
ccs compiner v5.120 processor pic24fj256gb110
i can't use
Code:
 enable_interrupts(INTR_GLOBAL);

or
Code:
 enable_interrupts(GLOBAL);

the 24fj256gb110.h file:
Code:
// Constants used in other interrupt functions are:
#if getenv("VERSION") > 5.061
#define INTR_GLOBAL              0x0800
#define GLOBAL                   0x0800 // For compatibility with PIC16/18
#define INTR_NORMAL              0x1000
#define INTR_ALTERNATE           0x2000
#define INTR_LEVEL0              0x3000
#define INTR_LEVEL1              0x3001
#define INTR_LEVEL2              0x3002
#define INTR_LEVEL3              0x3003
#define INTR_LEVEL4              0x3004
#define INTR_LEVEL5              0x3005
#define INTR_LEVEL6              0x3006
#define INTR_LEVEL7              0x3007
#else
#define INTR_GLOBAL              0x0400
#define GLOBAL                   0x0400 // For compatibility with PIC16/18
#define INTR_NORMAL              0x0100
#define INTR_ALTERNATE           0x0200
#define INTR_LEVEL0              0x0500
#define INTR_LEVEL1              0x0501
#define INTR_LEVEL2              0x0502
#define INTR_LEVEL3              0x0503
#define INTR_LEVEL4              0x0504
#define INTR_LEVEL5              0x0505
#define INTR_LEVEL6              0x0506
#define INTR_LEVEL7              0x0507
#endif

i think "VERSION" is not recognized


Code:
#ZERO_RAM
#include <24FJ256GB110.h>
#device ADC=10
#device ICSP=2
    #FUSES NODEBUG                 
    #FUSES ICSP1                   
    #FUSES NOWINDIS
    #FUSES WPOSTS16                 
    #FUSES IESO                     
    #FUSES NOCKSFSM                 
    #FUSES NOOSCIO                 
    #FUSES HS                       
    #FUSES NOIOL1WAY
    #FUSES NOWPCFG               
    #FUSES NOWPDIS 
    #FUSES PR_PLL                   
    #FUSES PLL3                 
    #FUSES RESERVED                 
    #FUSES DISUVREG
    #use delay(clock=32000000,crystal=8000000)


#define LED3   PIN_C13
#define LED4   PIN_C14

//#priority  INT_RDA2, INT_TIMER2 ,INT_RDA

int cont_1s=0;
volatile int temp;

#INT_TIMER2
void my_timer2_isr (){ 
  if(++cont_1s>100){//0,5 seconds
    cont_1s=0;   
    output_toggle(PIN_D15);   
  }
}


void main()   {
 
    int cont=0;
    output_a(0);
    set_tris_a (0b0000000000000000);
    output_b(0);
    set_tris_b (0b0000001100101111);
    set_pulldown(1, PIN_B0);     //per il galleggiante ho bisogno di un pull down
    set_pulldown(1, PIN_B1);   
    //set_pullup(TRUE,PIN_B0);
    //set_pulldown(TRUE, PIN_B1);
    output_c(0);
    set_tris_c (0b0000000000001110);
    output_d(0);
    set_tris_d (0b0000100001001100);
    output_e(0);
    set_tris_e(0);
    output_f(0);
    set_tris_f(0xffff);
    output_g(0);
    set_tris_g (0b0000000100000000);
             
   
    enable_interrupts(INT_TIMER2);
 
 
    enable_interrupts(INTR_GLOBAL);
   
    output_low(PIN_G7);
    while(1){
       
    }
}
Ttelmah



Joined: 11 Mar 2010
Posts: 19892

View user's profile Send private message

PostPosted: Tue Jul 08, 2025 7:00 am     Reply with quote

And this has what to do with Error 51??????.
Do not use old threads to post. Launch a new thread if you have a new
problem.
However the code as posted compiles OK on 5.120 for me. I suggest you
re-install your compiler.
ciccioc74



Joined: 23 Mar 2010
Posts: 43

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

PostPosted: Tue Jul 08, 2025 9:01 am     Reply with quote

I'm not using an old thread. It just won't compile if I use enable_interrupts(INTR_GLOBAL); and it gives me error 51.
I'll try reinstalling the compiler.
Code:
Compiling xxx\blinkLedGb110.X\BlinkMain on 08-lug-25 at 16:58:
xxx\blinkLedGb110.X\BlinkMain.c:149:23:  Error#51  A numeric expression must appear here  :: Not a valid interrupt:
xxx\blinkLedGb110.X\BlinkMain.o ===>  1 Errors,  0 Warnings.:
Build Failed.:
make[2]: *** [build/default/production/BlinkMain.o] Error 31
nbproject/Makefile-default.mk:115: recipe for target 'build/default/production/BlinkMain.o' failed
make[2]: Leaving directory 'xxx/blinkLedGb110.X'
nbproject/Makefile-default.mk:91: recipe for target '.build-conf' failed
make[1]: Leaving directory 'xxx/blinkLedGb110.X'
nbproject/Makefile-impl.mk:39: recipe for target '.build-impl' failed
make[1]: *** [.build-conf] Error 2
make: *** [.build-impl] Error 2

BUILD FAILED (exit value 2, total time: 717ms)


thank you
Ttelmah



Joined: 11 Mar 2010
Posts: 19892

View user's profile Send private message

PostPosted: Tue Jul 08, 2025 10:06 am     Reply with quote

You _are_ using an old thread. Threads in the forum should try to keep to
the subject heading they have. Your new question is about code failing
to compile, not Error 51.
jeremiah



Joined: 20 Jul 2010
Posts: 1393

View user's profile Send private message

PostPosted: Wed Jul 09, 2025 8:15 am     Reply with quote

If reinstalling doesn't work, something to consider:

It looks like from the error you posted that the code provided here is not the code that is erroring. It looks like line 149 of the file is in error. My guess here is you have some code before that is wrong and the error is just propagating to that line instead.
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