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


Interupts priorities on PIC18

Posted by Marcelo Adrian Lorenzati Sanz on October 19, 2008
Hi all,
I´m using FreeRTOS with PIC18 and I´ve modified the port to work with priorities (High priority for the prvTickISR) and low priority for the others (like USART and I2C).
Is there any consideration to have in mind? because I´m having a strange behaviour with the task that manages the I2C that waits for the I2C semaphore to be signaled.

here the ISR code:

#pragma code high_vector=0x08
static void prvHighInterrupt( void )
/* Was the interrupt the tick? */
if( PIR1bits.CCP1IF )
goto prvTickISR
#pragma code

#pragma code low_vector=0x18
static void prvLowInterrupt( void )
/*i2c interrupt*/
if( PIR1bits.SSPIF )
goto vI2cISR

/* Was the interrupt a byte being received? */
if( PIR1bits.RCIF )
goto vSerialRxISR

/* Was the interrupt the Tx register becoming empty? */
if( PIE1bits.TXIE && PIR1bits.TXIF )
goto vSerialTxISR
#pragma code

Here the timer int hook and i2c int hook:

#pragma interrupt prvTickISR
static void prvTickISR( void )
/* Interrupts must have been enabled for the ISR to fire, so we have to
save the context with interrupts enabled. */
PIR1bits.CCP1IF = 0;

/* Maintain the tick count. */

#if configUSE_PREEMPTION == 1
/* Switch to the highest priority task that is ready to run. */


#pragma interruptlow vI2cISR save=PRODH, PRODL, TABLAT, section(".tmpdata")
void vI2cISR( void )
{ .....

Do I have to manage the global interrupt? (GIEH , GIEL )

RE: Interupts priorities on PIC18

Posted by Dave on October 21, 2008
Looking at this (I try to avoid looking at anything with PIC18 in it) it seems the FreeRTOS code only uses the one priority so using both would require some effort to change the port.

RE: Interupts priorities on PIC18

Posted by Marcelo Adrian Lorenzati Sanz on October 21, 2008
Thanks, its true.
I´ve been diggin around and the port its not optimized to use priorities.

[ 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