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



Posted by fabrice48 on July 15, 2014


i have a doubt about the interrupt handler on pic24 : the official document explain this,

Interrupt can be written in C exactly as described in the compiler. Then it was discussed about TWO interrupt handler, C method and ASM method.

readind the manual several time but i don't understand if i can use C or if i have to use ASM ?

here an example about the Scondary UART Rx Interrupt. Can i use this code ? is it correct ?

typedef struct { unsigned char screenpos; char* screenmess; } lcd_data;

lcddata infoserie;

void attribute((interrupt, noautopsv)) U2RXInterrupt(void) { IFS1bits.U2RXIF = 0; while( DataRdyUART2()) { message[0] = ReadUART2(); WriteUART2( message[0] +1 ); infoserie.screenmess = message; infoserie.screenpos = 10; xQueueSendToBackFromISR(xQueuelcd, &info_serie,0);



thank you for help.



Posted by davedoors on July 15, 2014

There are two interrupt handlers defined in the PIC24 demo for you to copy (in this file http://sourceforge.net/p/freertos/code/HEAD/tree/trunk/FreeRTOS/Demo/PIC24_MPLAB/serial/serial.c) and this is what the documentation page for the PIC24 port says:

"Interrupt service routines that cannot cause a context switch have no special requirements and can be written as per the compiler documentation. Interrupt service routines that can cause a context switch must execute with priority portKERNELINTERRUPTPRIORITY, and only call taskYIELD() at the very end of the service routine after the interrupt source has been cleared. See the file serial.c included in the demo application for an example."

no mention of assembly code, I don't know what it is you are reading.


Posted by fabrice48 on July 15, 2014

Hello Dave, my document is the one bought on official freertos website, it's page 89. as i said, i just have a 'doubt' so if the interrupt does not cause a context switch AND if it canoot be itself interrupted i can use the C handler. i just began with FreeRtos.

the assembly kind is discussed a the very end of this page. my document is the one for PIC32.

thank you


Posted by davedoors on July 15, 2014

Each chip/compiler port necessarily has a different way of doing it because of the constraints of the architecture and the compiler syntax.

[ 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