在线时间3 小时
UID3500699
注册时间2018-8-11
NXP金币0
该用户从未签到
新手上路

- 积分
- 29
- 最后登录
- 2018-8-17
|

楼主 |
发表于 2018-8-13 15:48:11
|
显示全部楼层
/*
** ===================================================================
** Method : UART1_Init (component Init_UART)
** Description :
** This method initializes registers of the UART module
** according to the Peripheral Initialization settings.
** Call this method in user code to initialize the module. By
** default, the method is called by PE automatically; see "Call
** Init method" property of the component for more details.
** Parameters : None
** Returns : Nothing
** ===================================================================
*/
void UART1_Init(void)
{
/* SIM_SCGC: UART1=1 */
SIM_SCGC |= SIM_SCGC_UART1_MASK;
/* UART1_C2: TIE=0,TCIE=0,RIE=0,ILIE=0,TE=0,RE=0,RWU=0,SBK=0 */
UART1_C2 = 0x00U;
/* UART1_BDH: LBKDIE=0,RXEDGIE=0,SBNS=0,SBR=0 */
UART1_BDH = UART_BDH_SBR(0x00);
/* UART1_BDL: SBR=0x34 */
UART1_BDL = UART_BDL_SBR(0x34);
/* UART1_C1: LOOPS=0,UARTSWAI=0,RSRC=0,M=0,WAKE=0,ILT=0,PE=0,PT=0 */
UART1_C1 = 0x00U;
/* UART1_S2: LBKDIF=1,RXEDGIF=1,??=0,RXINV=0,RWUID=0,BRK13=0,LBKDE=0,RAF=0 */
UART1_S2 = (UART_S2_LBKDIF_MASK | UART_S2_RXEDGIF_MASK);
(void) UART1_S1; /* Dummy read of the UART1_S1 register to clear flags */
(void) UART1_D; /* Dummy read of the UART1_D register to clear flags */
/* UART1_C3: R8=0,T8=0,TXDIR=0,TXINV=0,ORIE=0,NEIE=0,FEIE=1,PEIE=0 */
UART1_C3 = UART_C3_FEIE_MASK;
/* UART1_C2: TIE=0,TCIE=0,RIE=1,ILIE=0,TE=1,RE=1,RWU=0,SBK=0 */
UART1_C2 = (UART_C2_RIE_MASK | UART_C2_TE_MASK | UART_C2_RE_MASK);
}
/*
** ###################################################################
**
** The interrupt service routine(s) must be implemented
** by user in one of the following user modules.
**
** If the "Generate ISR" option is enabled, Processor Expert generates
** ISR templates in the CPU event module.
**
** User modules:
** main.c
** Events.c
**
** ###################################################################
** */
PE_ISR(Uart1_isr_handler)
{
// NOTE: The routine should include actions to clear the appropriate
// interrupt flags.
//
}
///////////////////////////////////////////////
我是第一次使用这个CW,知道需要添加相应的代码,但是,从上面看,是不是只要在
PE_ISR(Uart1_isr_handler)下添加就可以了?我还是不太放心 ,一直没有看到那个中断向量。
谢谢! |
|