- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
PSoC™ CreatorでPSoC™ 4のUARTボーレートを変更 – KBA234803
Translated by: MaMi_1205306
Original KBA: https://community.infineon.com/t5/Knowledge-Base-Articles/Change-PSoC-4-UART-baud-rate-in-PSoC-Creat...
バージョン : **
UARTボーレートは、SCBコンポーネントを駆動するクロックによって決定され、 式 1を使用して計算されたクロック分周器の値(clkDivider)に依存します :
- PSoC™ Creatorプロジェクトの最上位のデザイン(* .cysch)にUARTコンポーネントを配置します。
- 図 1に示すように、クロック(Clock_1)を有効にします :
図 1 *.cyschコンポーネント - この例では、UARTコンポーネント構成で次の設定を行います。図 2を参照してください :
図 2 UARTコンポーネントの構成
- HFCLK (高速クロック) : 24 MHz
- オーバーサンプル : 13
- ターゲットボーレート : 115,200 bps
5. APIで計算値から1を引いた値(この場合は16–1)を使用して、main.cファイルのコードスニペットに示されているようにクロックを構成します :
Clock_1_SetFractionalDividerRegister(15,0); //UART baud rate 115200 16-1
コードリスト 1/* Start SCB (UART mode) operation */
Clock_1_Stop();
if(uartboaudrate115200)
{
Clock_1_SetFractionalDividerRegister(15,0); //UART baud rate 115200 16-1
}
else
{
if(uartboaudrate9600)
{
Clock_1_SetFractionalDividerRegister(199,0); //UART baud rate 9600 200-1
}
}
Clock_1_Start();
UART_Start();
while(1)
{
UART_UartPutString("This is SCB_UartComm custom baudrate example project\r\n");
UART_UartPutString("\r\n");
CyDelay(500);
}図 3 結果の表示 :
図 3 テスト結果