Positron16 "Counter.inc" compilation errors - 33FJ12GP202 -

Started by Wimax, Aug 19, 2022, 04:49 PM

Previous topic - Next topic

Wimax

Hi Folks !

I need to count the pulse number on a PIN everytime a timer interrupt routine is triggered.
The interrupt routine performs few operations perfectly and I wish add the pulse count function also.

I'm experiencing some compilation errors when I try to include "Counter.inc" just before the interrupt handling routine. It seems to be in conflict with another file, included where needed ("PWM_24.inc"), generating a series of error messages as: "Possibly incorrect amount of parameters !(PWM_24.inc)".

The "PWM_24.inc" file operates correctly and all the program runs well if I don't try to include "Counter.inc".


top204

In the "Counter.inc" file, change the line:

        Sub.w W6,#1,W6                          ' \ Decrement the 32-bit gate counter

To:

        @Sub.w W6,#1,W6                          ' \ Decrement the 32-bit gate counter

Because the PIC24 and dsPIC33 devices have an assembler mnemonic named Sub and I used it in the program as a high level mnemonic, the compiler is mistaking it for a Sub-EndSub start, so causing the problem. Adding the "@" in front of it, makes it into a true assembler mnemonic and the parser ignores it and sends it directly through to the assembler listing.

I obviously wrote the library code before I added the Sub-EndSub directives. :-)

I'll get into the parser and stop the compiler mistaking a Sub mnemonic for the Sub directive, somehow. :-)


Wimax

#2
Hi Les,

I have never seen such a simple and elegant solution as this before !  ;D

I forgot to say that all is running perfectly now !

Thank you very much  !

Max