• slider image 442
  • slider image 477
  • slider image 479
  • slider image 480
  • slider image 481
  • slider image 482
:::


Browsing this Thread:   1 Anonymous Users






Re: dsp33fj UART RX中斷後RESET
#4
版主
版主


查看用戶資訊
可以的,一個結構型態或共用型態的宣告內,也可含有其它的共用型態或結構型態。

範例:
union FPvar
{
   
float FPNum;            //floating point access
   
struct
   
{
      
unsigned char Arg0;        //argument byte 0 access
      
unsigned char Arg1;        //argument byte 1 access
      
unsigned char Arg2;        //argument byte 2 access
      
unsigned char Exp;        //exponent byte access
   
ByByte;
Foo;
Foo.FPNum 3.14159;
Exponent Foo.ByByte.Exp 0x7F;


UART_Status_Flag.bits.UART_RX_ReadStart
UART_Status 是共用資料結構
而 UART_RX_ReadStart 是位元結構的一個成員

發表於: 2021/8/3 12:59
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: dsp33fj UART RX中斷後RESET
#3
初級會員
初級會員


查看用戶資訊
小弟才疏學淺,弱弱地問一問,"UART_Status_Flag.bits.UART_RX_ReadStart"這樣的參數中間有2個".",有這樣的參數嗎?

發表於: 2021/8/3 12:07
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


Re: dsp33fj UART RX中斷後RESET
#2
版主
版主


查看用戶資訊
我在懷疑是不是 Memory Access 的錯誤導致產生的 NMI 的 Trap 中斷執行的 Default 的 RESET 指令。
1. 在接收的中斷函數因為沒有讀取接收的資料,導致接收 FIFO 被覆蓋了,這時會產生 Receive Overrun Error
2. 請檢查這一行的結構宣告,或改用其他旗號的設定方式。

dsPIC30F example code:
Read receiver data from Interrupt    
void _ISR _U1RXInterrupt
(void)
{
    
Rec_Buffer ReadUART1( );  // Read data from Receiver FIFO
    
Rec_Flag 1;                 // Set the Received Flag
    
IFS0bits.U1RXIF ;                    // Clear Interrupt Flag
}
Using ReadUART1( )
unsigned int ReadUART1(void)
{
    if(
U1MODEbits.PDSEL == 3)    // 9-bit data format?
        
return (U1RXREG);
    else
        return (
U1RXREG 0xFF);
}

發表於: 2021/8/3 10:18
Twitter Facebook Google Plus Linkedin Del.icio.us Digg Reddit Mr. Wong 頂部


dsp33fj UART RX中斷後RESET
#1
初級會員
初級會員


查看用戶資訊
請問有人遇過當RX中斷收到值MCU就會RESET嗎?裡面只有放下面這兩個程式碼Struct以及中斷旗標歸零

void __attribute__( ( interrupt , no_auto_psv ) ) _U1RXInterrupt( void )
{
UART_Status_Flag.bits.UART_RX_ReadStart = 1; //開始讀取旗標
IFS0bits.U1RXIF = 0; //清除UART2 Rereived的中斷旗標。
}

會發現MCU好像RESET是因為明明程式有些東西值會執行一次,但是卻一直重複執行,
後來一個一個註解掉後發現在RX中斷把下面程式註解掉就正常

UART_Status_Flag.bits.UART_RX_ReadStart = 1; //開始讀取旗標

請問在RX中斷裡面是不能執行這個部份嗎?

發表於: 2021/8/2 16:29
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... ]

教育訓練中心

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