Browsing this Thread:
1 Anonymous Users
|
Re: 关于dspic 30f 2010定时器的问题
|
|
新會員
Joined
: 2009/7/7 16:11 最後登入時間
: 2009/7/8 9:39
Group:
註冊會員
Level : 1 HP : 0 / 0 MP : 0 / 30 EXP : 2
|
这是我的程序,虽然片子不一样,但希望高手能帮忙介绍下思路,非常谢谢!
#include "p30f4012.h"
_FOSC(CSW_FSCM_OFF&HS); _FWDT(WDT_OFF); _FBORPOR(PBOR_OFF&MCLR_EN); _FGS(CODE_PROT_OFF);
void delay(unsigned int tt01) { while(--tt01){;} }
void __attribute__((__interrupt__))_T2Interrupt(void) { IFS0bits.T2IF=0; T2CONbits.TON=0; _RD1=!_RD1; TMR2=0; T1CONbits.TON=1; }
void __attribute__((__interrupt__))_T1Interrupt(void) { IFS0bits.T1IF=0; T1CONbits.TON=0; t=TMR1; TMR1=0; T2CONbits.TON=1; }
int main(void) { _RD1=0; TRISD=0xFFF0; T1CON=0x0030; TMR1=0; IEC0bits.T1IE=1; IFS0bits.T1IF=0; T1CONbits.TON=1;
T2CON=0x0030; TMR2=0; PR2=t; IEC0bits.T2IE=1; IFS0bits.T2IF=0;
delay(30000); IFS0bits.T1IF=1; delay(50000);
}
發表於: 2009/7/7 16:44
|
|
|
关于dspic 30f 2010定时器的问题
|
|
新會員
Joined
: 2009/7/7 16:11 最後登入時間
: 2009/7/8 9:39
Group:
註冊會員
Level : 1 HP : 0 / 0 MP : 0 / 30 EXP : 2
|
请问: 我最近刚学 16 bit的片子C 30F 2010,现在要用一个定时器测主程序的工作时间,再用另一个定时器以测得的时间为周期PR定时产生一个中断!该如何操作,谢谢 附程序!
發表於: 2009/7/7 16:19
|
|
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.