在线看毛片网站电影-亚洲国产欧美日韩精品一区二区三区,国产欧美乱夫不卡无乱码,国产精品欧美久久久天天影视,精品一区二区三区视频在线观看,亚洲国产精品人成乱码天天看,日韩久久久一区,91精品国产91免费

<menu id="6qfwx"><li id="6qfwx"></li></menu>
    1. <menu id="6qfwx"><dl id="6qfwx"></dl></menu>

      <label id="6qfwx"><ol id="6qfwx"></ol></label><menu id="6qfwx"></menu><object id="6qfwx"><strike id="6qfwx"><noscript id="6qfwx"></noscript></strike></object>
        1. <center id="6qfwx"><dl id="6qfwx"></dl></center>

            新聞中心

            S3C2440之觸摸屏

            作者: 時間:2016-11-27 來源:網(wǎng)絡(luò) 收藏
            Test_Touchpanel.c實現(xiàn)檢測觸點坐標(biāo)
            1. #defineREQCNT30
            2. #defineADCPRS9//YH0627
            3. #defineLOOP1
            4. void__irqAdcTsAuto(void);
            5. intcount=0;
            6. volatileintxdata,ydata;
            7. voidTest_Touchpanel(void)
            8. {
            9. rADCDLY=50000;//Normalconversionmodedelayabout(1/3.6864M)*50000=13.56ms
            10. rADCCON=(1<<14)+(ADCPRS<<6);//ADCPRSEn,ADCPRSValue
            11. Uart_Printf("ADCtouchscreentest");
            12. rADCTSC=0xd3;//[0:7]Wfait,XP_PU(在等待中斷模式下,上拉電阻要有效),XP_Dis,XM_Dis,YP_Dis,YM_En
            13. pISR_ADC=(int)AdcTsAuto;
            14. rINTMSK=~BIT_ADC;//ADCTouchScreenMaskbitclear,enableADCint
            15. rINTSUBMSK=~(BIT_SUB_TC);//enablesubADCint
            16. Uart_Printf("Typeanykeytoexit!!!");
            17. Uart_Printf("StylusDown,please......");
            18. Uart_Getch();
            19. rINTSUBMSK|=BIT_SUB_TC;//getakeythenmasksubADCint;exit
            20. rINTMSK|=BIT_ADC;//maskADCint
            21. Uart_Printf("TouchScreenTestisFinished!!!");
            22. }
            23. void__irqAdcTsAuto(void)
            24. {
            25. inti;
            26. U32saveAdcdly;
            27. if(rADCDAT0&0x8000)
            28. {
            29. //Uart_Printf("StylusUp!!");
            30. rADCTSC&=0xff;//Setstylusdowninterruptbit
            31. }
            32. //else
            33. //Uart_Printf("StylusDown!!");
            34. rADCTSC=(1<<3)|(1<<2);//Pull-updisable,(在觸發(fā)中斷后,上拉電阻要無效)Seq.X,Ypostionmeasure.
            35. saveAdcdly=rADCDLY;//saveADCDLY(啟動延時)
            36. rADCDLY=40000;//Normalconversionmodedelayabout(1/50M)*40000=0.8ms
            37. rADCCON|=0x1;//startADC
            38. while(rADCCON&0x1);//checkifEnable_startislow,轉(zhuǎn)換開啟結(jié)束
            39. while(!(rADCCON&0x8000));//checkifEC(EndofConversion)flagishigh,Thislineisnecessary~!!
            40. //conversionover
            41. while(!(rSRCPND&(BIT_ADC)));//checkifADCisfinishedwithinterruptbit,等待中斷清零?
            42. xdata=(rADCDAT0&0x3ff);
            43. ydata=(rADCDAT1&0x3ff);//讀取轉(zhuǎn)換結(jié)果,x軸坐標(biāo)值放入rADCDAT0,y軸坐標(biāo)值放入ADCDAT1
            44. //YH0627,TocheckStylusUpInterrupt.
            45. rSUBSRCPND|=BIT_SUB_TC;
            46. ClearPending(BIT_ADC);//清楚中斷標(biāo)志位
            47. rINTSUBMSK=~(BIT_SUB_TC);//使能中斷?
            48. rINTMSK=~(BIT_ADC);
            49. rADCTSC=0xd3;//Waitingforinterrupt//[0:7]Wfait,XP_PU,XP_Dis,XM_Dis,YP_Dis,YM_En
            50. rADCTSC=rADCTSC|(1<<8);//Detecttylusupsinterruptsignal.檢查觸筆抬起中斷
            51. while(1)//tocheckPen-upstate
            52. {
            53. if(rSUBSRCPND&(BIT_SUB_TC))//checkifADCisfinishedwithinterruptbit
            54. {
            55. //Uart_Printf("StylusUpInterrupt~!");//觸筆抬起!
            56. break;//ifStylusisup(1)state
            57. }
            58. }
            59. Uart_Printf("count=dXP=d,YP=d",count++,xdata,ydata);//X-positionConversiondata
            60. rADCDLY=saveAdcdly;//恢復(fù)ADCDLY原值
            61. rADCTSC=rADCTSC&~(1<<8);//DetectstylusDowninterruptsignal.檢查觸筆落下中斷(下一次檢測)
            62. rSUBSRCPND|=BIT_SUB_TC;
            63. rINTSUBMSK=~(BIT_SUB_TC);//Unmasksubinterrupt(TC)//使能中斷
            64. ClearPending(BIT_ADC);
            65. }

            效果圖:

            本文引用地址:http://www.biyoush.com/article/201611/322378.htm
            上一頁 1 2 下一頁

            關(guān)鍵詞: S3C2440觸摸

            評論


            相關(guān)推薦

            技術(shù)專區(qū)

            關(guān)閉