本实验为mini2440触摸屏裸机驱动实验,通过点击触摸屏获得该点的坐标,然后通过UART显示在电脑上,主要配置ADCCON控制寄存器,利用中断模式读取X,Y坐标,并显示出来,代码后注释已经详细给出,具体实验代码如下:
#define GLOBAL_CLK 1
#include
#include
#include
#include
#include
#include
#include
#include
#include
volatile
void
{
U32
if
{
Uart_Printf("\nStylus
rADCTSC
}
else
{
Uart_Printf("\nStylus
}
rADCTSC
saveAdcdly
rADCDLY
rADCCON
while
while
while
xdata
ydata
//Check
rSUBSRCPND
ClearPending(BIT_ADC);
rINTSUBMSK
rINTMSK
rADCTSC
rADCTSC
while
{
if
{
Uart_Printf("Stylus
break;
}
}
Uart_Printf("count=%d
rADCTSC
rSUBSRCPND
rINTSUBMSK
ClearPending(BIT_ADC);
}
void
{
rADCDLY
rADCCON
Uart_Printf("\n[ADC
rADCTSC
pISR_ADC
rINTMSK
rINTSUBMSK
Uart_Printf("\nType
Uart_Printf("\nStylus
Uart_Getch();
rINTSUBMSK
rINTMSK
Uart_Printf("[Touch
}
void
{
MMU_Init();//初始化内存,实现内存地址重定向
AdcTs_Test();
while(1);
}