• slider image 442
  • slider image 483
  • slider image 484
  • slider image 485
  • slider image 486
  • slider image 487
  • slider image 488
  • slider image 491
:::

論壇索引


Board index » All Posts (zhannj)




Re: 关于dspic 30f 2010定时器的问题
#1
新會員
新會員


这是我的程序,虽然片子不一样,但希望高手能帮忙介绍下思路,非常谢谢!

#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定时器的问题
#2
新會員
新會員


请问:
我最近刚学 16 bit的片子C 30F 2010,现在要用一个定时器测主程序的工作时间,再用另一个定时器以测得的时间为周期PR定时产生一个中断!该如何操作,谢谢 附程序!

發表於: 2009/7/7 16:19
頂部






:::

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... ]

教育訓練中心

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