ARM9触摸屏
ARM9触摸屏的程序的控制,主要对3个寄存器的控制
(1)、ADCCON 设置AD转化频率
/*设置AD转频率*/
preScaler = ADC_FREQ;
Uart_Printf("ADC conv,freq. = %dHz\n",preScaler);
preScaler = 50000000/ADC_FREQ - 1; //PCLK=50M
rADCCON = (1<<14)|(preScaler<<6);//ADCPRS En,PRSCVL
// rADCCON=(1<<14)+(preScaler<<6); //ADCPRS En, ADCPRS Value
(2)、ADCTSC设置触屏控制寄存器
/*设置触摸屏为等待中断模式,等待触摸笔被按下*/
rADCTSC=0xd3; //Wfait,XP_PU,XP_Dis,XM_Dis,YP_Dis,YM_En
(3)、SRCPND、INTPND设置寄存器,即设置父中断和子中断,即INT_ADC 和 INT_ADC_S、INT_TC
rSRCPND = 0x80000000; //父中断 INT_ADC
rINTPND = 0x80000000;//父中断 INT_ADC
ClearSubPending(BIT_SUB_TC); //SUBSRCPND 子中断 INT_TC
pISR_ADC = (U32)AdcTsAuto;
/*enable INT_TC irq*/
//EnableIrq(BIT_ADC);
rINTMSK = 0x7fffffff; www.zzzyk.com
EnableSubIrq(BIT_SUB_TC) //开启子中断
#define EnableSubIrq(bit)rINTSUBMSK &= ~(bit)
#define BIT_SUB_TC(0x1<<9)
__inline void ClearSubPending(int bit)
{
register i;
rSUBSRCPND = bit;
i = rINTPND;
}
(4)、当中断产生时,引发中断服务程序
pISR_ADC = (U32)AdcTsAuto;
补充:综合编程 , 其他综合 ,