Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Real time embedded FreeRTOS mailing list 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem TCP & FAT Training




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 ]    [ Sitemap ]    [ ]




Copyright (C) 2004-2010 Richard Barry. Copyright (C) 2010-2016 Real Time Engineers Ltd.
Any and all data, files, source code, html content and documentation included in the FreeRTOSTM distribution or available on this site are the exclusive property of Real Time Engineers Ltd.. See the files license.txt (included in the distribution) and this copyright notice for more information. FreeRTOSTM and FreeRTOS.orgTM are trade marks of Real Time Engineers Ltd.

Latest News:

FreeRTOS V9.0.0 is now available for download.


Free TCP/IP and file system demos for the RTOS


Sponsored Links

⇓ Now With No Code Size Limit! ⇓
⇑ Free Download Without Registering ⇑


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Renesas Electronics Gold Alliance RTOS Partner.jpg

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Atmel RTOS partner supporting ARM Cortex-M3 and AVR32 microcontrollers

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

Xilinx Microblaze and Zynq partner

Silicon Labs low power RTOS partner

Altera RTOS partner for Nios II and Cortex-A9 SoC

Freescale Alliance RTOS Member supporting ARM and ColdFire microcontrollers

Infineon ARM Cortex-M microcontrollers

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

Cypress RTOS partner supporting ARM Cortex-M3

Fujitsu RTOS partner supporting ARM Cortex-M3 and FM3

Microsemi (previously Actel) RTOS partner supporting ARM Cortex-M3

Atollic Partner

IAR Partner

Keil ARM Partner

Embedded Artists