Quality RTOS & Embedded Software

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


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

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

Latest News

FreeRTOS v10.2.0 is available for immediate download. MIT licensed, and including RISC-V and ARMv8-M (Cortex-M33) demos.

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

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


FreeRTOS and other embedded software careers at AWS.

FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Cadence Tensilica Cortes

Espressif ESP32

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers





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