PDA

توجه ! این یک نسخه آرشیو شده میباشد و در این حالت شما عکسی را مشاهده نمیکنید برای مشاهده کامل متن و عکسها بر روی لینک مقابل کلیک کنید : راه اندازی وقفه تایمر



h.yazdanian
07-12-2011, 12:11
با سلام خدمت تمامی دوستان
چند وقته به راه اندازی وقفه تایمر at91sam7s در نرم افزار keil نیاز پیدا کردم ولی تا به حال موفق نشدم. :unh:از دوستان تقاضا دارم کمکم کنند.
با استفاده از تایمر می خوام فرکانس یک سیگنال رو اندازه بگیرم.(در واقع می خوام زمان پیکهای سیگنال ECG رو تشخیص بدم).اگه میشه راهنماییم کنید.cry::

h.yazdanian
11-12-2011, 11:12
بالاخره خودم یه برنامه نوشتم ولی نمیدونم چرا صفر رو روی lcd نمایش نمیده!
فایل برنامه رو پیوست کردم.برنامه ساعت رو نوشتم.

kesh kesh
18-12-2016, 18:17
سلام دوستان من میخام وقفه arm راه اندازی کنم ولی نمیشه طبق اصول هم پیش رفتم کسی هست کمک کنه؟


#include <LPC213X.H>

unsigned int i;
/////////////////////////////////// Interrupt service routine EINT0
__irq void EINT0 (void){
EXTINT=0x01; //clear the interrupt flag of EINT0
FIO0SET=0x01; //set P0.0
for(i=0;i<1200000;i++); //delay 1s
FIO0CLR=0x01; //clear P0.0
VICVectAddr=0; //acknowledge to end of interrupt
}
/////////////////////////////////// Interrupt service routine EINT1
__irq void EINT1 (void){
EXTINT=0x02; //clear the interrupt flag of EINT1
FIO0SET=0x02; //set P0.1
for(i=0;i<1200000;i++); //delay 1s
FIO0CLR=0x02; //clear P0.1
VICVectAddr=0; //acknowledge to end of interrupt
}
///////////////////////////////////Main
void main(void){
SCS|=0x01; //set Fast GPIO for P0 and P1
FIO0DIR=0x03; //set P0.0 and P0.1 as output
PINSEL0=0xcc; //set P2.10 to EINT0, and P2.11 to EINT1
VICIntSelect=0; //set EINT0 and EINT1 interrupts to IRQ
VICIntEnable=3<<14; //enable EINT0 and EINT1 interrupts
VICVectAddr14=(unsigned int)EINT0; //set address of EINT0 interrupt service routine
VICVectAddr15=(unsigned int)EINT1; //set address of EINT1 interrupt service routine
VICVectCntl14=0x20|1; //set priority of EINT0 to priority level 1
VICVectCntl15=0|0x20; //set priority of EINT1 to priority level 0
EXTMODE=0x03; //set EINT0 and EINT1 to edge sensitive
EXTPOLAR=0x00; //set falling edge for EINT0 and EINT1
while(1); //wait
}

- - - Updated - - -

سلام دوستان من میخام وقفه arm راه اندازی کنم ولی نمیشه طبق اصول هم پیش رفتم کسی هست کمک کنه؟


#include <LPC213X.H>

unsigned int i;
/////////////////////////////////// Interrupt service routine EINT0
__irq void EINT0 (void){
EXTINT=0x01; //clear the interrupt flag of EINT0
FIO0SET=0x01; //set P0.0
for(i=0;i<1200000;i++); //delay 1s
FIO0CLR=0x01; //clear P0.0
VICVectAddr=0; //acknowledge to end of interrupt
}
/////////////////////////////////// Interrupt service routine EINT1
__irq void EINT1 (void){
EXTINT=0x02; //clear the interrupt flag of EINT1
FIO0SET=0x02; //set P0.1
for(i=0;i<1200000;i++); //delay 1s
FIO0CLR=0x02; //clear P0.1
VICVectAddr=0; //acknowledge to end of interrupt
}
///////////////////////////////////Main
void main(void){
SCS|=0x01; //set Fast GPIO for P0 and P1
FIO0DIR=0x03; //set P0.0 and P0.1 as output
PINSEL0=0xcc; //set P2.10 to EINT0, and P2.11 to EINT1
VICIntSelect=0; //set EINT0 and EINT1 interrupts to IRQ
VICIntEnable=3<<14; //enable EINT0 and EINT1 interrupts
VICVectAddr14=(unsigned int)EINT0; //set address of EINT0 interrupt service routine
VICVectAddr15=(unsigned int)EINT1; //set address of EINT1 interrupt service routine
VICVectCntl14=0x20|1; //set priority of EINT0 to priority level 1
VICVectCntl15=0|0x20; //set priority of EINT1 to priority level 0
EXTMODE=0x03; //set EINT0 and EINT1 to edge sensitive
EXTPOLAR=0x00; //set falling edge for EINT0 and EINT1
while(1); //wait
}