Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem


Loading

PIC24 interrupt

Posted by amarjith on November 5, 2013

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. */ portSWITCH_CONTEXT(); 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. */ dossetvect( 0x82, vExampleInterruptHandler );

Could you please explain this in detail to me.


PIC24 interrupt

Posted by richardbarry on November 5, 2013

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

Posted by amarjith on November 5, 2013

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

Posted by richardbarry on November 5, 2013

Could you clarify these lines too,

They are only relevant to the x86 port, not the PIC24 port.

Regards.


PIC24 interrupt

Posted by amarjith on November 5, 2013

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


PIC24 interrupt

Posted by richardbarry on November 5, 2013

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.


[ Back to the top ]    [ About FreeRTOS ]    [ Privacy ]    [ Sitemap ]    [ ]


Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.

Latest News

NXP tweet showing LPC5500 (ARMv8-M Cortex-M33) running FreeRTOS.

Meet Richard Barry and learn about running FreeRTOS on RISC-V at FOSDEM 2019

Version 10.1.1 of the FreeRTOS kernel is available for immediate download. MIT licensed.

View a recording of the "OTA Update Security and Reliability" webinar, presented by TI and AWS.


Careers

FreeRTOS and other embedded software careers at AWS.



FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Espressif ESP32

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Renesas

STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

OpenRTOS and SafeRTOS

Xilinx Microblaze and Zynq partner