Browsing this Thread:
2 Anonymous Users
|
Re: 中斷問題
|
|
版主
Joined
: 2004/4/30 10:53 最後登入時間
: 2021/11/30 18:11
From CAE, Microchip
Group:
站務管理者 註冊會員
Level : 75 HP : 744 / 1861 MP : 5367 / 111159 EXP : 45
|
使用同一個中斷進入後再判斷是 RC1IF 或 RC2IF 所發生的中斷再跳到相對應的接收程式讀取 RCREG
發表於: 2007/5/14 17:42
|
|
|
中斷問題
|
|
中級會員
Joined
: 2007/3/15 10:54 最後登入時間
: 2008/1/3 16:21
Group:
註冊會員
Level : 6 HP : 0 / 140 MP : 20 / 7214 EXP : 62
|
#pragma code low_vector=0x18 // 設定中斷進入點 if(RC1IF==1) { void low_interrupt(void) { _asm goto Rx1_isr _endasm } #pragma code #pragma interruptlow Rx1_isr void Rx1_isr(void) {
receive_buff[buff_point++]=Read1USART(); if(buff_point >= 2) { receive_flag = 1 buff_point= 0; }//end if(buff_point >= 2) }//end void Rx1_isr(void) }//end if(RC1IF==1) //----------------------------------------------------------------- if(RC2IF==1) { void low_interrupt(void) { _asm goto Rx2_isr _endasm } #pragma code #pragma interruptlow Rx2_isr void Rx2_isr(void) {
receive_buff2[buff_point2++]=Read2USART(); if(buff_point2 >= 2) { receive_flag2 = 1 buff_point2= 0; }//end if(buff_point2 >= 2) }//end void Rx2_isr(void) }//end if(RC2IF==1)
我要用2個uart,然後都是使用接收中斷 請問要使用2個優先權相同,但是中斷源不同的中斷,可以像我上面寫的這樣使用嗎? 請問像上面這樣子使用,需要開啟哪幾個中斷功能呢? (1).全域中斷控制 (2).週邊中斷功能 (3).中斷優先功能 (4).低優先中斷功能 (5).高優先中斷功能
發表於: 2007/5/14 12:59
|
|
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.