|  | 
 
| 是基于开发板提供的UCOSII加上开发板裸奔TEST2440里的TOUCHPANEL.C里的一些函数自己弄的。但是好像不能用。。。请版主帮忙。 这是我的设置中断的函数
 void SetTSInterrupt(void) //设置中断向量,开中断:
 
 
 {
 
 rADCDLY=50000;                  //Normal conversion mode delay about (1/3.6864M)*50000=13.56ms
 rADCCON=(1<<14)+(ADCPRS<<6);   //ADCPRS En, ADCPRS Value
 
 //Uart_Printf("\nTouch Screen test\n");
 
 rADCTSC=0xd3;  //Wfait,XP_PU,XP_Dis,XM_Dis,YP_Dis,YM_En
 
 pISR_ADC = (int)AdcTsAuto;
 rINTMSK=~BIT_ADC;       //ADC Touch Screen Mask bit clear,&是我加的
 rINTSUBMSK=~(BIT_SUB_TC);
 }
 
 这个是原来TEST2440里触摸板的测试程序里的函数
 void __irq AdcTsAuto(void)
 {
 U32 saveAdcdly;
 
 if(rADCDAT0&0x8000)
 {
 //Uart_Printf("\nStylus Up!!\n");
 rADCTSC&=0xff;        // Set stylus down interrupt bit
 }
 //else
 //Uart_Printf("\nStylus Down!!\n");
 
 rADCTSC=(1<<3)|(1<<2);         //Pull-up disable, Seq. X,Y postion measure.
 saveAdcdly=rADCDLY;
 rADCDLY=40000;                 //Normal conversion mode delay about (1/50M)*40000=0.8ms
 
 rADCCON|=0x1;                   //start ADC
 
 while(rADCCON & 0x1);                //check if Enable_start is low
 while(!(rADCCON & 0x8000));        //check if EC(End of Conversion) flag is high, This line is necessary~!!
 
 while(!(rSRCPND & (BIT_ADC)));  //check if ADC is finished with interrupt bit
 
 xdata=(rADCDAT0&0x3ff);
 ydata=(rADCDAT1&0x3ff);
 
 //check Stylus Up Interrupt.
 rSUBSRCPND|=BIT_SUB_TC;
 ClearPending(BIT_ADC);
 rINTSUBMSK=~(BIT_SUB_TC);
 rINTMSK=~(BIT_ADC);
 
 rADCTSC =0xd3;    //Waiting for interrupt
 rADCTSC=rADCTSC|(1<<8); // Detect stylus up interrupt signal.
 
 while(1)                //to check Pen-up state
 {
 if(rSUBSRCPND & (BIT_SUB_TC))        //check if ADC is finished with interrupt bit
 {
 //Uart_Printf("Stylus Up Interrupt~!\n");
 break;        //if Stylus is up(1) state
 }
 }
 
 //Uart_Printf("count=%03d  XP=%04d, YP=%04d\n", count++, xdata, ydata);    //X-position Conversion data
 //Lcd_printf(30,180,RGB( 0xFF,0xFF,0xFF),RGB( 0x00,0x00,0x00),0,"屏幕中断测试:x:%d : y:%d : 第%d次\n",xdata,ydata,++count);
 //xPhys=xdata;
 //yPhys=ydata;
 Uart_Printf("INTERUPPT!!!\n");
 Uart_Printf("\nrADCDAT0 is:%x; rADCDAT1 is:%x; rADCTSC is:%x; rADCCON is:%x;\n rADCDLY is:%x; BIT_ADC is:%x  \n",rADCDAT0,rADCDAT1,rADCTSC,rADCCON,rADCDLY,BIT_ADC);
 rADCDLY=saveAdcdly;
 rADCTSC=rADCTSC&~(1<<8); // Detect stylus Down interrupt signal.
 rSUBSRCPND|=BIT_SUB_TC;
 rINTSUBMSK=~(BIT_SUB_TC);        // Unmask sub interrupt (TC)
 ClearPending(BIT_ADC);
 Uart_Printf("INTERUPPT DONE!!!\n");
 }
 我把SetTSInterrupt()直接挂到主程序的初始模块里,好像中断不正常,是不是寄存器和中断处理没有设置好。
 | 
 |