Wrapper Class for PIC24FJ256GB210

poonam4996 wrote on Monday, May 13, 2013:

Hello Everyone….
I am trying to write the wrapper class for PIC24FJ256GB210 controller using the MPLAB C30 compiler v3.25 .  An outline of the assembly code wrapper is as below

#include <p24FJ256GB210.h>
#include <sys/asm.h> 
#include "ISR_Support.h"
	.set		        nomips16
 	.set 		        noreorder
 	
 	.extern		vUART_ISR_Handler	
	
	.extern		xISRStackTop
	
 	.global		_U1TXInterrupt			
	.set		        noreorder
	.set 		        noat
	.ent		      _U1TXInterrupt			
_U1TXInterrupt:							
	portSAVE_CONTEXT
	jal			vUART_ISR_Handler		
	nop
	portRESTORE_CONTEXT
	.end		_U1TXInterrupt			

The included file “sys/asm.h” is a C32 file . I need to know which file needs to be included for the C30 compiler and also the best  method to handle interrupts.

rtel wrote on Monday, May 13, 2013:

Sorry I’m not sure what it is you are trying to achieve.  You mention a PIC24 MCU but have posted PIC32 code.  Which MCU family are you writing the code for?  If a PIC24 then you do not need the wrapper.  The documentation page for the PIC24 code has the following text in the “Interrupt Service Routines” section:

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 portKERNEL_INTERRUPT_PRIORITY, 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.

Regards.