Compiler Specific C Code | Keil C51 ISR Function Error

Hi There...

I have found an interesting thing and thought to share it over here.

While coding for an ISR function, that gets triggered during an interrupt service routine needs to be written in Keil as a compiler-specific code.

The code snippet looks like - 

void Timer2_ISR (void) interrupt 5
{
   //ISR Routine code
}

 

The code interrupt 5 is a compiler-specific and does not follow standard C syntax. Here the interrupt 5 is actually setting the vector number 5 during the compilation process by the Keil. However, this could provide syntax error in different IDE where the IDE uses C type generic syntax parser.

Debasis Parida

  Joined August 22, 2019      125

Thursday at 12:29 PM

Information was very useful !!! Thanks a lot for sharing.

Debashis Das

  Joined December 02, 2019      117

Monday at 10:02 PM

Thanks a lot for sharing.