• 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: DSPIC33F 进入串口初始化程序程序就自动跳出
#3
新會員
新會員


查看用戶資訊
谢谢了哦,就是这个原因
后来关掉TX中断就好了
不过我现在又碰到一个A/D的问题
再开个贴吧
再次感谢您

發表於: 2007/10/13 16:42
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: DSPIC33F 进入串口初始化程序程序就自动跳出
#2
中級會員
中級會員


查看用戶資訊
提供一點意見給你參考...

請修改程序如以下:

void COM_init()
{
U1MODEbits.STSEL = 0; // 1-stop bit
U1MODEbits.PDSEL = 0; // No Parity, 8-data bits
U1MODEbits.ABAUD = 0; // Autobaud Disabled

U1BRG = BRGVAL; // BAUD Rate Setting for 9600
// STEP 1:
// Configure UART for DMA transfers

U1STAbits.UTXISEL0 = 0; // Interrupt after one Tx character is transmitted
U1STAbits.UTXISEL1 = 0;
U1STAbits.URXISEL = 0; // Interrupt after one RX character is received

// STEP 2:
// Enable UART Rx and Tx

U1MODEbits.UARTEN = 1; // Enable UART1
U1STAbits.UTXEN = 1; // Enable UART1 Tx

IPC2bits.U1RXIP=7; //Interrupt is priority 7 (highest priority interrupt)
//先清除中斷旗號, 再致能中斷
IFS0bits.U1TXIF =0; // clear intrrupt TX IF
IFS0bits.U1RXIF =0; // clear intrrupt RX IF
//先不致能 TX 中斷, 因為 TX 為空(可發送) 即進入中斷
//這裡並無資料要立刻傳送
IEC0bits.U1TXIE =0; // Disable uart1 tx intrrupt
IEC0bits.U1RXIE =1; // Enable uart1 tx intrrupt

// IEC4bits.U1EIE = 0;
}


******************************************
大概是進入了 TX 的中斷了,
在要 發送資料時再適時 致能 TX 中斷吧!

發表於: 2007/10/4 9:46
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


DSPIC33F 进入串口初始化程序程序就自动跳出
#1
新會員
新會員


查看用戶資訊
我用的是DSPIC33F, 用ICD2调试
调试其他程序时都能正确运行
但我加进了串口初始化程序后,程序就会自动跳出,运行完毕
不再向下执行

void COM_init()
{
U1MODEbits.STSEL = 0; // 1-stop bit
U1MODEbits.PDSEL = 0; // No Parity, 8-data bits
U1MODEbits.ABAUD = 0; // Autobaud Disabled

U1BRG = BRGVAL; // BAUD Rate Setting for 9600
// STEP 1:
// Configure UART for DMA transfers

U1STAbits.UTXISEL0 = 0; // Interrupt after one Tx character is transmitted
U1STAbits.UTXISEL1 = 0;
U1STAbits.URXISEL = 0; // Interrupt after one RX character is received

// STEP 2:
// Enable UART Rx and Tx

U1MODEbits.UARTEN = 1; // Enable UART1
U1STAbits.UTXEN = 1; // Enable UART1 Tx

IPC2bits.U1RXIP=7; //Interrupt is priority 7 (highest priority interrupt)
IEC0bits.U1TXIE =1; // Enable uart1 tx intrrupt
IEC0bits.U1RXIE =1; // Enable uart1 tx intrrupt

IFS0bits.U1TXIF =0; // clear intrrupt TX IF
IFS0bits.U1RXIF =0; // clear intrrupt RX IF

// IEC4bits.U1EIE = 0;
}

这是我的串口初始化程序有什么不妥之处吗
希望各位高手指教一下

發表於: 2007/10/3 19:53
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... ]

教育訓練中心

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