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


Browsing this Thread:   1 Anonymous Users






Re: 30f4011 uart問題請教
#5
資深會員
資深會員


查看用戶資訊
感謝jackylts/cct1210/master前輩的指點,已解決,問題就是在這理,直接設定是不錯的選擇

發表於: 2010/2/2 8:55
不怕苦...苦半輩子;怕苦...苦一輩子
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 30f4011 uart問題請教
#4
資深會員
資深會員


查看用戶資訊
參照:

lancer0498 寫道:
請教各位前輩
我使用mplab 8.43 +C30
IC為dsPIC30F4011

使用周邊函式庫,我有加入<uart.h>header file
參考dsPIC30F_dsPIC33F_PIC24H_UART_Help.htm
為何下以下的參數時會有問題
U1STAvalue = UART_INT_TX_BUF_EMPTY &
UART_TX_PIN_NORMAL &
UART_TX_ENABLE &
UART_INT_RX_3_4_FUL &
UART_ADR_DETECT_DIS &
UART_RX_OVERRUN_CLEAR;

出錯的地方在UART_TX_PIN_NORMAL 這一行
拿掉就OK了,以下為錯誤訊息

test.c:170: error: 'UART_TX_PIN_NORMAL' undeclared (first use in this function)
test.c:170: error: (Each undeclared identifier is reported only once
test.c:170: error: for each function it appears in.)
test.c:195:2: warning: no newline at end of file

請問這是何原因,一直找不出來,謝謝!!!



請參考http://www.microchip.com.tw/modules/n ... de=flat&order=ASC&start=0

拿掉UART_TX_PIN_NORMAL 這一行,編譯雖然過了,實際燒錄至硬體中uart中的TX,是完全沒訊號的,所以等於白搭.
順便小聲告訴你,若可以,直接設定有關uart暫存器的值會比較穩當的.

發表於: 2010/2/1 23:10
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 30f4011 uart問題請教
#3
資深會員
資深會員


查看用戶資訊
偷懶的話直接手動定義
#define UART_TX_PIN_NORMAL 0xF7FF

這行找不到似乎是因為用了4011以後,MACRO用了_dsPIC30F4011__後面定義區段,而不幸的的 UART_TX_PIN_NORMAL並沒有在其中。

發表於: 2010/2/1 19:46
不要問我哪裡來,我只是個流浪天涯的工程師
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 30f4011 uart問題請教
#2
新會員
新會員


查看用戶資訊
在Program Files\Microchip\MPLAB C30\src\peripheral_30F_24H_33F\include\uart.h裡面,
UxSTA的bit定義跟文件不一樣

內容如下

/* defines for UART Status register */

#define UART_INT_TX_BUF_EMPTY 0xDFFF /* Interrupt on TXBUF becoming empty */
#define UART_INT_TX_LAST_CH 0x7FFF /* Interrupt when last character shifted out*/
#define UART_INT_TX 0x5FFF /* Interrupt on transfer of every character to TSR */

#define UART_IrDA_POL_INV_ONE 0xFFFF /*IrDA encoded, UxTX Idle state is '1' */
#define UART_IrDA_POL_INV_ZERO 0xBFFF /* IrDA encoded, UxTX Idel state is '0' */

#define UART_SYNC_BREAK_ENABLED 0xFFFF /* Send sync break on next transmission */
#define UART_SYNC_BREAK_DISABLED 0xF7FF /* Sync break transmission disabled or completed */

#define UART_TX_ENABLE 0xFFFF /* Transmit enable */
#define UART_TX_DISABLE 0xFBFF /* Transmit disable */

#define UART_TX_BUF_FUL 0xFFFF /* Transmit buffer is full */
#define UART_TX_BUF_NOT_FUL 0xFDFF /* Transmit buffer is not full */

#define UART_INT_RX_BUF_FUL 0xFFFF /* Interrupt on RXBUF full */
#define UART_INT_RX_3_4_FUL 0xFFBF /* Interrupt on RXBUF 3/4 full */
#define UART_INT_RX_CHAR 0xFF7F /* Interrupt on every char received */

#define UART_ADR_DETECT_EN 0xFFFF /* address detect enable */
#define UART_ADR_DETECT_DIS 0xFFDF /* address detect disable */

#define UART_RX_OVERRUN_CLEAR 0xFFFD /* Rx buffer Over run status bit clear */

發表於: 2010/2/1 14:32
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


30f4011 uart問題請教
#1
資深會員
資深會員


查看用戶資訊
請教各位前輩
我使用mplab 8.43 +C30
IC為dsPIC30F4011

使用周邊函式庫,我有加入<uart.h>header file
參考dsPIC30F_dsPIC33F_PIC24H_UART_Help.htm
為何下以下的參數時會有問題
U1STAvalue = UART_INT_TX_BUF_EMPTY &
UART_TX_PIN_NORMAL &
UART_TX_ENABLE &
UART_INT_RX_3_4_FUL &
UART_ADR_DETECT_DIS &
UART_RX_OVERRUN_CLEAR;

出錯的地方在UART_TX_PIN_NORMAL 這一行
拿掉就OK了,以下為錯誤訊息

test.c:170: error: 'UART_TX_PIN_NORMAL' undeclared (first use in this function)
test.c:170: error: (Each undeclared identifier is reported only once
test.c:170: error: for each function it appears in.)
test.c:195:2: warning: no newline at end of file

請問這是何原因,一直找不出來,謝謝!!!

發表於: 2010/2/1 10:47
不怕苦...苦半輩子;怕苦...苦一輩子
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... ]

教育訓練中心

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