• 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: 求助,关于初始化总是复位的错误,附原程序,谢谢
#4
中級會員
中級會員


查看用戶資訊
你好!

沒有在你貼上的程序中看到 U2TX 與 U2RX 中斷程序,
所以很可能是你在 UART2_init() 中致能中斷所造成的,
(可能 U2TX = 1 後即進入 U2TX 中斷了...)

請修改

IFS1bits.U2TXIF = 0; // Clear the Transmit Interrupt Flag
IEC1bits.U2TXIE = 1; // Enable Transmit Interrupts
IFS1bits.U2RXIF = 0; // Clear the Recieve Interrupt Flag
IEC1bits.U2RXIE = 1; // Enable Recieve Interrupts



IFS1bits.U2TXIF = 0; // Clear the Transmit Interrupt Flag
IEC1bits.U2TXIE = 0; // Disable Transmit Interrupts
IFS1bits.U2RXIF = 0; // Clear the Recieve Interrupt Flag
IEC1bits.U2RXIE = 0; // Disable Recieve Interrupts

然後看你需要做中斷處理時再設定 U2TXIE 與 U2RXIE

Good Luck !!!!!

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


Re: 求助,关于初始化总是复位的错误,附原程序,谢谢
#3
版主
版主


查看用戶資訊
看起來像是發生了 Address Error 產生了 Error Trap。最簡單的除錯方式可以用 MPLAB SIM (軟件仿真)找一下錯誤的程式在哪裡。

發表於: 2008/10/13 9:31
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: 求助,关于初始化总是复位的错误,附原程序,谢谢
#2
新會員
新會員


查看用戶資訊
芯片是用dsPIC33FJ256GP710.

發表於: 2008/10/12 23:05
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


求助,关于初始化总是复位的错误,附原程序,谢谢
#1
新會員
新會員


查看用戶資訊
CORE-E0004: Trap due to unimplemented FLASH memory access, occurred from instruction at 0x0004b2

这类是什么错误,要怎么样能消除?

附程序:
int main(void)
{
// Configure Oscillator to operate the device at 40Mhz
// Fosc= Fin*M/(N1*N2), Fcy=Fosc/2
// Fosc= 8M*40(2*2)=80Mhz for 8M input clock
PLLFBD=38; // M=40
CLKDIVbits.PLLPOST=0; // N1=2
CLKDIVbits.PLLPRE=0; // N2=2
OSCTUN=0; // Tune FRC oscillator, if FRC is used
RCONbits.SWDTEN=0; /* Disable Watch Dog Timer*/

while(OSCCONbits.LOCK!=1) {}; /* Wait for PLL to lock*/

IO_init();
UART2_init(); //////////////注释掉这条语句,程序就正常走,加了这个,就出问题,总在这儿发生一个,上面所示的错误
LCD_init();
line0_puts(mytext);
line1_puts("DEMO");
ADC_init();
PWM_init();
while(1)
{
if(_RE0 == 0)
{
DELAYMS(10);
if(_RE0 == 0){
line1_puts("SEND 'H'..");
}
}
}
}
/******************************************************************************/

void IO_init()
{
AD1PCFGL = 0xFFFF;
AD1PCFGH = 0xFFFF;
AD2PCFGL = 0xFFFF;
PORTE = 0x0000;
TRISE = 0xFF0F;
}

void UART2_init()
{
// configure U2MODE
U2MODE = 0;

U2BRG = 240; // 40Mhz osc, 9600 Baud

U2STA = 0;

IPC7 = 0x7700; // Mid Range Interrupt Priority level, no urgent reason

IFS1bits.U2TXIF = 0; // Clear the Transmit Interrupt Flag
IEC1bits.U2TXIE = 1; // Enable Transmit Interrupts
IFS1bits.U2RXIF = 0; // Clear the Recieve Interrupt Flag
IEC1bits.U2RXIE = 1; // Enable Recieve Interrupts

U2MODEbits.UARTEN = 1; // And turn the peripheral on

U2STAbits.UTXEN = 1;
// I think I have the thing working now.
}


请DX帮忙看看!谢谢

發表於: 2008/10/12 23:03
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... ]

教育訓練中心

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