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


Browsing this Thread:   1 Anonymous Users






Re: UART 求解
#3
新會員
新會員


查看用戶資訊
感謝大大的指引我已經可以正常顯示了!!

但我現在還有其他問題我該如何產生中斷,然後再中斷程式中寫入資料,因為我想要在終端機寫入資料然後顯示在終端機!!

麻煩大大教一下該如何設定,以下是我的設定:

U1MODEbits.UARTEN = 1 ;
U1MODEbits.USIDL = 1 ;
U1MODEbits.IREN = 0 ;
U1MODEbits.RTSMD = 1 ;
U1MODEbits.WAKE = 0 ;
U1MODEbits.LPBACK = 1 ;
U1MODEbits.ABAUD =1 ;
U1MODEbits.URXINV =1 ;
U1MODEbits.BRGH = 0 ;
U1MODEbits.PDSEL = 0 ;
U1MODEbits.STSEL = 0 ;


U1STAbits.UTXISEL0 = 1 ;


U1STAbits.UTXBRK = 0 ;
U1STAbits.UTXEN = 1 ;
U1STAbits.UTXBF = 0 ;
U1STAbits.TRMT = 0 ;
U1STAbits.URXISEL =1 ;
U1STAbits.ADDEN = 0 ;
U1STAbits.RIDLE = 0 ;
U1STAbits.PERR =0 ;
U1STAbits.FERR =0 ;
U1STAbits.OERR = 0 ;
U1STAbits.URXDA = 1 ;




IEC0bits.U1RXIE = 1 ;
IPC2bits.U1RXIP = 1 ;
IFS0bits.U1RXIF = 0 ;
U1BRG = 25;


中斷函式 :

void _ISR _U1RXInterrupt(void)

{
IFS0bits.U1RXIF = 0 ;

敘述區......
}

發表於: 2009/2/1 11:53
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: UART 求解
#2
版主
版主


查看用戶資訊
"顯示亂碼" 建議先檢查 Baud-Rate 是否正確,System Clock 的頻率設定 (Configuration Bits) 是否正確? 如有示波器量一下 TxD 的輸出。

發表於: 2009/1/30 22:08
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


UART 求解
#1
新會員
新會員


查看用戶資訊
請求各位高手 APP021 DSP33FJ128MC708 UART的問題?

以下的程式在終端機只顯示亂碼 :

#define BAUD_VALUE 95

void main ()

{

Init_UART () ;
putsUART1("i am DSP3F") ;
//printf("TOTO DSP33F") ;
}

void Init_UART ()

{

unsigned int U1MODE_value ;

unsigned int U1STA_value ;

CloseUART1 () ;

ConfigIntUART1 (UART_RX_INT_EN & UART_RX_INT_PR6

& UART_TX_INT_DIS & UART_TX_INT_PR2) ;

U1MODE_value = UART_EN & UART_IDLE_STOP

& UART_MODE_SIMPLEX & UART_DIS_WAKE & UART_EN_LOOPBACK

& UART_EN_ABAUD & UART_BRGH_SIXTEEN & UART_NO_PAR_8BIT

& UART_1STOPBIT ;

U1STA_value = UART_INT_TX_BUF_EMPTY & UART_TX_ENABLE & UART_INT_RX_CHAR

& UART_ADR_DETECT_DIS & UART_RX_OVERRUN_CLEAR ;


OpenUART1 (U1MODE_value , U1STA_value , BAUD_VALUE) ;

}

請各位高手看一下我只是單純的想在終端機顯示printf的內容而已
請問是那裡出了問題嗎?

發表於: 2009/1/30 20:59
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... ]

教育訓練中心

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