Difference between revisions of "Custom Interrupts - dsPIC/PIC24"

From Flowcode Help
Jump to navigationJump to search
(XML Import to change Variable types into Variable Types)
Line 27: Line 27:
 
'''Handler code:'''
 
'''Handler code:'''
  
<font style="color:#000080">void _ISR _U1RXInterrupt(void)
+
<font style="color:#000080">void _ISR _U1RXInterrupt(void)</font>
 
 
{
 
 
 
FCM_%n(); // call selected macro
 
 
 
IFS0bits.U1RXIF = 0; // clear interrupt
 
 
 
} </font>
 

Revision as of 11:09, 10 June 2013

Here are a few examples for such interrupts using 16-bit PICmicro chips. To create interrupts that are not shown below you will have to refer to the device datasheet. Once the code has been placed into the custom interrupt properties dialog, the interrupt can be enabled and disabled like any of the standard Flowcode Interrupts.


USART receive - This can be nicely integrated with the Flowcode RS232 component.

Target PIC Processor ( dsPIC30F2011 )

(Note: For other PIC devices you may have to refer to the device datasheet to obtain the correct code)


USART receive

Gen Custom Interrupts dsPIC-PIC24 USART.png

The Flowcode RS232 component can be used to set the Baud rate and configure the mode of operation, and the ReceiveRS232Char function can be used in the handler macro to read the data (clearing the interrupt).


Enable code:

IEC0bits.U1RXIE = 1; //Enable USART receive interrupts


Disable code:

IEC0bits.U1RXIE = 0; //Disable USART receive interrupts


Handler code:

void _ISR _U1RXInterrupt(void)