• slider image 442
  • slider image 477
  • slider image 479
  • slider image 480
  • slider image 481
  • slider image 482
:::


Browsing this Thread:   1 Anonymous Users






Re: PIC18F4685 UART Baud rate
#4
初級會員
初級會員


查看用戶資訊
謝謝大家的回覆

因為搭配硬體設計,Baud rate設定 19200

發表於: 2020/6/17 22:14
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: PIC18F4685 UART Baud rate
#3
版主
版主


查看用戶資訊
參考一下網友 linwangco 的建議:

將 Fosc 的速度提升到 20Mhz 在 115.2Kbps 的速度下,Baud-Rate 的誤差就降為 0.94% 這是可以接受的誤差範圍。

如果是用內建的 FRC 8MHz 的話,其誤差約 2% 這就不太適合高速的 UART 傳輸。建議改用 4MHz Crystal 配合 PLL 電路提高頻率,這樣UART 才會穩定。

發表於: 2020/6/16 12:13
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: PIC18F4685 UART Baud rate
#2
資深會員
資深會員


查看用戶資訊
把表格看完
只有圖中的右下角那個設定可以達到115200
但是ERROR RATE高達 2.12%
不建議使用

我認為你可以把fosc往上提升速度。

Attach file:



jpg  (0.00 KB)


發表於: 2020/6/16 10:02
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


PIC18F4685 UART Baud rate
#1
初級會員
初級會員


查看用戶資訊
FOSC = 8.000 MHz
Baud rate設定 9600, 19200, 57600設定通訊正常
設定為115200時,可接收發送

但是接收到的數值發送出來,值是錯誤的

想請問,是不是哪邊沒注意到



OSCCON = 0x60;
OSCTUNEbits.PLLEN = 1;


// USART Initialize
OpenUSART( USART_TX_INT_OFF // Set TXSTA Reg. = 0b11111111 ( PIE1bits.TXIE = 1 )
& USART_RX_INT_OFF // Set RCSTA Reg. = 0b10010000 ( PIE1bits.RCIE = 1 )
& USART_ASYNCH_MODE // Asynchronous Mode( TXASTAbits.SYNC = 0 )
& USART_EIGHT_BIT // 8-bit transmit/receive( TXSTAbits.TX9 = 0 ; RCSTAbits.RX9 = 0 )
& USART_CONT_RX // Continuous reception( RCSTAbits.CREN = 1 )
& USART_BRGH_HIGH // High baud rate( TXSTAbits.BRGH = 1 )
, BaudRate_GEN); // SPBRG

Attach file:



jpg  (0.00 KB)


發表於: 2020/6/16 9:49
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部







You can view topic.
不可以 發起新主題
You cannot reply to posts.
You cannot edit your posts.
You cannot delete your posts.
You cannot add new polls.
You cannot vote in polls.
You cannot attach files to posts.
You cannot post without approval.
You cannot use topic type.
You cannot use HTML syntax.
You cannot use signature.
You cannot create PDF files.
You cannot get print page.

[進階搜尋]


:::

Microchip連結

https://www.facebook.com/microchiptechnologytaiwan/
http://www.microchip.com.tw/modules/tad_uploader/index.php?of_cat_sn=13
https://mu.microchip.com/page/tmu
http://elearning.microchip.com.tw/modules/tad_link/index.php?cate_sn=1
https://page.microchip.com/APAC-PrefCenters-TW.html
http://www.microchip.com/
http://www.microchip.com/treelink
http://www.microchipdirect.com/
http://www.microchip.com.cn/newcommunity/index.php?m=Video&a=index&id=103
http://www.microchip.com.tw/modules/tad_uploader/index.php?of_cat_sn=2
http://www.microchip.com.tw/Data_CD/eLearning/index.html
http://www.microchip.com.tw/RTC/RTC_DVD/
https://www.microchip.com/development-tools/
https://www.youtube.com/user/MicrochipTechnology
[ more... ]

教育訓練中心

!開發工具購買
辦法說明 [業界客戶] [教育單位]
----------------------------------
!校園樣品申請
辦法說明 [教師資格] [學生資格]
----------------------------------