⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 configintuart2.c

📁 Mplab C30编译器
💻 C
字号:
#if defined(__PIC24F__)
#include <p24Fxxxx.h>
#endif
#include "uart.h"

#ifdef _UART_IRDA_V1_2

/**********************************************************************
Function Prototype : void ConfigIntUART2(unsigned int config)

Include            : uart.h
 
Description        : This function configures the UART Interrupts.
 
Arguments          : config - Individual interrupt enable/disable information 
                     as defined below
					 Receive Interrupt enable					
					    UART_RX_INT_EN					
					    UART_RX_INT_DIS					
					 Receive Interrupt Priority					
					    UART_RX_INT_PR0					
					    UART_RX_INT_PR1				
					    UART_RX_INT_PR2					
					    UART_RX_INT_PR3					
					    UART_RX_INT_PR4					
					    UART_RX_INT_PR5					
					    UART_RX_INT_PR6					
					    UART_RX_INT_PR7					
					 Transmit Interrupt enable					
					    UART_TX_INT_EN					
					    UART_TX_INT_DIS					
					 Transmit Interrupt Priority					
					    UART_TX_INT_PR0					
					    UART_TX_INT_PR1					
					    UART_TX_INT_PR2					
					    UART_TX_INT_PR3					
					    UART_TX_INT_PR4					
					    UART_TX_INT_PR5					
					    UART_TX_INT_PR6					
					    UART_TX_INT_PR7
 
Return Value       : None
 
Remarks            : This function enables/disables the UART transmit and
                     receive interrupts and sets the interrupt priorities.
**********************************************************************/
void ConfigIntUART2(unsigned int config)
{
    /* clear IF flags */
    IFS1bits.U2RXIF = 0;
    IFS1bits.U2TXIF = 0;

    /* set priority */
    IPC7bits.U2RXIP = 0x0007 & config;
    IPC7bits.U2TXIP = (0x0070 & config) >> 4;

    /* enable/disable interrupt */
    IEC1bits.U2RXIE = (0x0008 & config) >> 3;
    IEC1bits.U2TXIE = (0x0080 & config) >> 7;
}

#else
#warning "Does not build on this target"
#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -