• slider image 442
  • slider image 497
  • slider image 498
  • slider image 499
  • slider image 500
  • slider image 502
:::


Browsing this Thread:   1 Anonymous Users






Re: P18F4520 USART設定...請問版主
#8
資深會員
資深會員


查看用戶資訊
我記得 Microchip 的 UART 函數會去判斷是否有使用9-bit 傳輸的。不過我還是建議你將相關的 UART Source cdoe 函數找出來加以檢查一下,畢竟使用 9-bit 的功能還是要看一下其操作的程序,9-bit 接收後 bit 9 又釋放在哪裡的這些都是要看一下 Source Code 才會了解的。
*********************************************
小弟目前資料進來時,進中斷就直RX_DATA=ReadUSART();
然後回主程式將資料丟進陣列,並沒有去讀TX9D這個位元,
想說直接不做同位元的驗證,但都資料出去時會用到TX9D這個位元來放parity!
另外請教版主,我接收時是否須讀TX9D這個bit?

發表於: 2009/9/28 13:07
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: P18F4520 USART設定...請問版主
#7
版主
版主


查看用戶資訊
我記得 Microchip 的 UART 函數會去判斷是否有使用9-bit 傳輸的。不過我還是建議你將相關的 UART Source cdoe 函數找出來加以檢查一下,畢竟使用 9-bit 的功能還是要看一下其操作的程序,9-bit 接收後 bit 9 又釋放在哪裡的這些都是要看一下 Source Code 才會了解的。

發表於: 2009/9/28 11:33
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: P18F4520 USART設定...請問版主
#6
資深會員
資深會員


查看用戶資訊
請教版主,以下是C18內建的USART函式
因為在應用上有個疑問,我目前使用9BIT模式,
TX9D放的是parity,會將TXSTAbits.TX9設為1,
但我使用這個內建函式時會有問題,
一進入函式內因為我的TX9=1,那我TX9D會立刻被設定為0,
還是這個函式不適用在9BIT模式,須要自己寫一個嗎?

void WriteUSART(char data)
{
if(TXSTAbits.TX9) // 9-bit mode?
{
TXSTAbits.TX9D = 0;
// Set the TX9D bit according to the
if(USART_Status.TX_NINE)
// USART Tx 9th bit in status reg
TXSTAbits.TX9D = 1;
}

TXREG = data; // Write the data byte to the USART
}

發表於: 2009/9/28 9:09
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: P18F4520 USART設定
#5
資深會員
資深會員


查看用戶資訊
了解了,感謝版大回覆!

發表於: 2009/8/17 15:32
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: P18F4520 USART設定
#4
版主
版主


查看用戶資訊
接收時還是要以相同的 9-bit Data Mode 接收,Parity 要不要算出來檢驗隨你高興,收近來後直接放棄parity 的檢查當然可以。

發表於: 2009/8/17 15:01
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: P18F4520 USART設定
#3
資深會員
資深會員


查看用戶資訊
感謝版大的指點,另外請教版大,接收時應該就不需要特別這樣去判斷奇偶同位了吧?

發表於: 2009/8/17 14:54
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: P18F4520 USART設定
#2
版主
版主


查看用戶資訊
可以做得到的。使用 9-bit Data Mode 即可,d0~D7 使用軟體方式計算出 Even Parity Bit 後將其填入 Tx9 的位元後傳送即可完成。

發表於: 2009/8/17 13:59
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


P18F4520 USART設定
#1
資深會員
資深會員


查看用戶資訊
各位大大,小弟目前用P18F4520來偵測鋰電池保護板資訊,
但保護保USART的通訊格試為4800 8 E 1,我看了P18F4520的DATASHEET好像無法設定為8 E 1只能設定8 N 1,不知是否真的這樣,各位大大是否可指點一下?

發表於: 2009/8/17 12:04
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... ]

教育訓練中心

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