• slider image 442
  • slider image 483
  • slider image 484
  • slider image 485
  • slider image 486
  • slider image 487
:::


Browsing this Thread:   1 Anonymous Users




« 1 (2)


Re: 一個 USART 傳輸的問題
#2
初級會員
初級會員


查看用戶資訊
既然 9600 可以連

為何要設 115200

看一下設備的通訊協定

既然叫 "協定"

就是 通訊雙方 都要遵守的 約定

發表於: 2009/4/11 10:41
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


一個 USART 傳輸的問題
#1
中級會員
中級會員


查看用戶資訊
請問一下各位高手大大
我利用 PIC18F65J90 將其 TX、RX 接了一個設備
透過丟一各 command,該設備會回應訊息給 PIC
但現在有個問題是,我 Command 丟了,可是該設備都無任何回應
有量波形、PIC接腳位收端都無波行反應
但發送端腳位是有波形的,確定有將 command 送出去
不曉的是不是 Baud rate 設錯,baud rate 是 115200
是不是有大大可以幫我看一下那邊設錯,因為我有改用另外一顆 PIC18F6490
透過 PIC18F6490 將 command 丟給另一端設備,另一端設備也都有回應
但是改成PIC18F65J90後,command 丟了,可是另外一端設備卻不會有回應

以下是我 PIC18F65J90 的 OSC 和 USART 設定
==============================================
Configuration Bits 裡面的 Oscillator 為 INTOSC HS

OSCCONbits.IDLEN=0;
OSCCONbits.IRCF2=1;
OSCCONbits.IRCF1=1;
OSCCONbits.IRCF0=1;
OSCCONbits.OSTS=1;
OSCCONbits.IOFS=1;
OSCCONbits.SCS1=0;
OSCCONbits.SCS0=0;

OSCTUNEbits.INTSRC=1;
OSCTUNEbits.PLLEN=1;
OSCTUNEbits.TUN5=0;
OSCTUNEbits.TUN4=0;
OSCTUNEbits.TUN3=0;
OSCTUNEbits.TUN2=0;
OSCTUNEbits.TUN1=0;
OSCTUNEbits.TUN0=0;

Open1USART(
USART_TX_INT_OFF &
USART_RX_INT_ON &
USART_ASYNCH_MODE &
USART_EIGHT_BIT &
USART_CONT_RX &
USART_BRGH_HIGH,
16); // 16 for 115200 bps in 8MHz
=======================================================================
以下是我 PIC18F6490 的 OSC 和 USART 設定

Configuration Bits 裡面的 Oscillator 為 INT RC-CLKOUT on RA6,Port on RA7

OSCCONbits.IDLEN=0;
OSCCONbits.IRCF2=1;
OSCCONbits.IRCF1=1;
OSCCONbits.IRCF0=1;
OSCCONbits.OSTS=1;
OSCCONbits.IOFS=1;
OSCCONbits.SCS1=0;
OSCCONbits.SCS0=0;

OSCTUNEbits.INTSRC=1;
OSCTUNEbits.PLLEN=1;
OSCTUNEbits.TUN4=0;
OSCTUNEbits.TUN3=0;
OSCTUNEbits.TUN2=0;
OSCTUNEbits.TUN1=0;
OSCTUNEbits.TUN0=0;

Open1USART(
USART_TX_INT_OFF &
USART_RX_INT_ON & // 將USART接收設定為中斷方式接收
USART_ASYNCH_MODE &
USART_EIGHT_BIT &
USART_CONT_RX &
USART_BRGH_HIGH,
16); // 52 for 9600 bps in 8MHz

=====================================================================
基本上兩各PIC設定都一樣
只有 Configuration Bits 裡面的 Oscillator 不一樣

懇請各位大大指點了,先說聲謝謝

補充一下,有去量這兩各 PIC 送出來的 Command 的訊號
週期頻率明顯不一樣

發表於: 2009/4/10 16:41
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... ]

教育訓練中心

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