阅读:839回复:0
EZ-USB程序,奇怪!!23分等你拿!!!
我的参照EZ-USB的例子程序编写的中断服务程序如下:
由两个文件组成:一个是。A51,一个是C程序 下面是。A51程序: 我不明白: cseg at 43h ; \'int2jmp.a51\' ljmp 1800h ; address must match the \'#pragma\' end 下面是C程序: 我发现程序只能响应interrupt 10和interrupt 11,我该怎么办啊 #pragma intvector (0x17fd) #pragma interval (4) /*(去掉上面两句,可以响应interrupt 3,但是interrupt 10和interrupt 11都不响应了) #define ALLOCATE_EXTERN #include \"ezusb.h\" #include \"ezregs.h\" #include \"absacc.h\" main() { for (j=0; j<64; j++) // fill IN2 buffer with incrementing count IN2BUF[j]=j; IN2BC = 64; // arm the first transfer USBBAV = bmAVEN; // Enable autovector IN07IEN = bmEP2; // Enable EP2IN interrupt OUT07IEN = bmEP2; EUSB=1; ET1=1; TH1=0XFF; // TH1=0XAA; TR1=1; EA = 1; // Enable 8051 interrupts while (1); // loop forever, waiting for an interrupt } static void EP2IN_ISR (void) interrupt 10 // \'10\' is the EP2IN interrupt number { EZUSB_IRQ_CLEAR(); IN07IRQ = bmEP2; IN2BUF[0] = ++count; IN2BC = 64; } static void EP2OUT_ISR (void) interrupt 11 { int i, count; char adata[64]; EZUSB_IRQ_CLEAR(); OUT07IRQ = bmEP2; count = OUT2BC; for(i=0;i<count;i++) { adata=OUT2BUF; IN2BUF=adata; } OUT2BC=0; IN2BC=count; } static void timer1_isr(void) interrupt 3 { TR1=0; EA=0; TH1=0XAA; TL1=0XAA; //delay(1); switch(flag) { case 1: OUTA=0X00;flag=0;break; case 0: OUTA=0X01;flag=1;break; } TR1=1; EA=1; } |
|
最新喜欢:ybs |