PIC24 interrupt

On an interrupt routine I’ll have to use: I’m using Binary Semaphores for interrupt synchronization. as state on the FreeRTOS book: The syntax of the interrupt service routine declaration and the macro called to force a context switch are both specific to the Open Watcom DOS port and will be different for other ports. Please refer to the examples that are included in the demo application for the port being used to find the actual syntax required. static void __interrupt __far vExampleInterruptHandler( void ) { static portBASETYPE xHigherPriorityTaskWoken; xHigherPriorityTaskWoken = pdFALSE; /* ‘Give’ the semaphore to unblock the task. */ xSemaphoreGiveFromISR( xBinarySemaphore, &xHigherPriorityTaskWoken ); if( xHigherPriorityTaskWoken == pdTRUE ) { /* Giving the semaphore unblocked a task, and the priority of the unblocked task is higher than the currently running task – force a context switch to ensure that the interrupt returns directly to the unblocked (higher priority) task. NOTE: The actual macro to use to force ISR is dependent on the port. This is Open Watcom DOS port. Other ports may Refer to the examples provided for the the syntax required. */ portSWITCHCONTEXT(); a context switch from an the correct macro for the require different syntax. port being used to determine } } As such portSWITCH_CONTEXT is port dependent. I cannot find this function in the port of pic24F and interrupt handler function static void __interrupt __far vExampleInterruptHandler( void ), __asm{ int 0x82 } this line generates the interrupt. /* Install the interrupt handler. */ _dos_setvect( 0x82, vExampleInterruptHandler ); Could you please explain this in detail to me.

PIC24 interrupt

Please refer to the examples that are included in the demo application for the port being used to find the actual syntax required.
This is the documentation page for the PIC24: http://www.freertos.org/portpic24_dspic.html If you look at the “Interrupt Service Routines” section you will see it is actually much simpler on the PIC24. The demo in the FreeRTOS download (referenced from the same page) contains an example. Regards.

PIC24 interrupt

Thank you so much sir. yes, i got it i have changed my code like this void attribute((interrupt, autopsv)) _ExampleInterruptHandler( void ) { static portBASETYPE xHigherPriorityTaskWoken; xHigherPriorityTaskWoken = pdFALSE; /* ‘Give’ the semaphore to unblock the task. / xSemaphoreGiveFromISR( xBinarySemaphore, &xHigherPriorityTaskWoken ); if( xHigherPriorityTaskWoken == pdTRUE ) { / Giving the semaphore unblocked a task, and the priority of the unblocked task is higher than the currently running task – force a context switch to ensure that the interrupt returns directly to the unblocked (higher priority) task. NOTE: The actual macro to use to force ISR is dependent on the port. This is Open Watcom DOS port. Other ports may Refer to the examples provided for the the syntax required. */ taskYIELD();
}
} No errors now. Could you clarify these lines too, __asm{ int 0x82 } this line generates the interrupt. / Install the interrupt handler. / dossetvect( 0x82, vExampleInterruptHandler ); i cannot find Install the interrupt handler.in demo.

PIC24 interrupt

Could you clarify these lines too,
They are only relevant to the x86 port, not the PIC24 port. Regards.

PIC24 interrupt

Ok. how i Install the interrupt handler in pic24. could you say the equivalent code in pic24?

PIC24 interrupt

As per the documentation page – interrupts are installed using the standard compiler syntax described in the compiler manual, and there is an example in FreeRTOSDemoPIC24_MPLABserialserial.c. Regards.