牛卧堂MCU技术交流

标题: M0516 bsp __LIN通信例子 [打印本页]

作者: M0516LBN    时间: 2014-1-12 18:59
标题: M0516 bsp __LIN通信例子
M0516的两个UART的时钟源是一个时钟源 ,在bsp的例子选择的是外部晶振12M






这是要闹哪样

作者: a_ziliu    时间: 2014-1-13 21:41
It is ok for this sample code

* @param[in]  u32SrcFreq      UART clock source(UART_S) was divided by UART divider(UART_N)
* @param[in]  u32BaudRate     Target bitrate (Hz)

/*---------------------------------------------------------------------------------------------------------*/
/*  LIN Function Test                                                                                      */
/*---------------------------------------------------------------------------------------------------------*/
void LIN_FunctionTest()
{
    uint32_t u32Item;
    /* LIN Max Speeed is 20K */
    UART1->BAUD = UART_BAUD_MODE2 | UART_BAUD_DIV_MODE2(48000000,20000);


/**
* @brief      Compute Baud Rate Divider Settings by mode 2
*
* @param[in]  u32SrcFreq      UART clock source(UART_S) was divided by UART divider(UART_N)
* @param[in]  u32BaudRate     Target bitrate (Hz)
*   
* @return     None
*   
* @details    The function is used to get baud rate divider settings by mode 2 based on your settings.\n
*   
*             Example: UART clock source from PLL(48MHz) and UART clock divider is set 2.\n
*                      If desired baudrate is 115200, you can call UART_BAUD_DIV_MODE2(24000000,115200);
*                           
*/

#define UART_BAUD_DIV_MODE2(u32SrcFreq, u32BaudRate)    (((u32SrcFreq + (u32BaudRate/2)) / u32BaudRate)-2)     
作者: M0516LBN    时间: 2014-3-12 11:09
a_ziliu 发表于 2014-1-13 21:41
It is ok for this sample code

* @param  u32SrcFreq      UART clock source(UART_S) was divided by U ...

请问官网有没有  LIN总线接收的例子啊




欢迎光临 牛卧堂MCU技术交流 (http://nuvoton-mcu.com/) Powered by Discuz! X3.2