Difference between revisions of "Custom Interrupts - dsPIC/PIC24"
(Created page with " 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 t...") |
|||
Line 7: | Line 7: | ||
− | < | + | <font style="color:#FF0000">'''Target PIC Processor ( dsPIC30F2011 )''' |
'''(Note: For other PIC devices you may have to refer to the device datasheet to obtain the correct code)'''</font> | '''(Note: For other PIC devices you may have to refer to the device datasheet to obtain the correct code)'''</font> |
Revision as of 10:37, 16 May 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 <edit_icon_interrupt.htm>.
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
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)
{
FCM_%n(); // call selected macro
IFS0bits.U1RXIF = 0; // clear interrupt
}