关于第三章问题求助
我因为没有example3.1的源文件,所以就按照裸奔三部曲做,但是烧如arm后,有图片显示,但对我的点击豪无反应,能不能帮我分析下,或者把example3.1发到我的信箱576592039@qq.com 查UART,我也遇到过! yxl 发表于 2011-12-6 11:42 static/image/common/back.gif我也是刚刚做完这个实验,在主函数里添加while(1)循环有错误,搞的我好郁闷,最后就在源出厂程序的touchp ...
怎么改的 能把代码贴出来么 我在这卡了很久了 求救啊 恩 我搞定了 我是在中断里面加的 没用WHILE循环 谢谢啊 /*****************************************
NAME: Touchpanel.c
DESC: ADC & Touch screen test
*****************************************/
#include "def.h"
#include "2440addr.h"
#include "2440lib.h"
#define REQCNT 30
#define ADCPRS 9
#define LOOP 1
/***********************************/
extern unsigned char tu1_800480[];
extern unsigned char tu2_800480[];
extern unsigned char tu3_800480[];
extern unsigned char tu4_800480[];
extern unsigned char tu5_800480[];
extern unsigned char tu6_800480[];
/**********************************/
void __irq AdcTsAuto(void);
int count=0;
volatile int xdata, ydata;
void Test_Touchpanel(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);
/*
Uart_Printf("\nPress any key to quit!\n"); .
Uart_Printf("\nStylus Down, please...... \n");
Uart_Getch();
rINTSUBMSK|=BIT_SUB_TC;
rINTMSK|=BIT_ADC;
Uart_Printf("Touch Screen Test is Finished!!!\n");
*/
while(1)
{
Uart_Printf("\nTouch Screen test\n");
if(ydata>660)
if(xdata>500)
Paint_Bmp(0,0,800,480,tu1_800480) ;
elsePaint_Bmp(0,0,800,480,tu2_800480) ;
else if(ydata<330)
if(xdata>500)
Paint_Bmp(0,0,800,480,tu3_800480) ;
else Paint_Bmp(0,0,800,480,tu4_800480) ;
else
if(xdata>500)
Paint_Bmp(0,0,800,480,tu6_800480) ;
else
Paint_Bmp(0,0,800,480,tu5_800480) ;
}
}
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=%03dXP=%04d, YP=%04d\n", count++, xdata, ydata); //X-position Conversion data
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);
}
我用的是7寸屏,如果你用的是4.3的话就再改改!我的附件上传不聊,我就把我改的touchpanel.c函数粘上来,还有图片函数就你自己写了,太多了我就不传了 1013269594 发表于 2011-8-29 09:05 static/image/common/back.gif
查UART,我也遇到过!
求助我因为没有example3.1的源文件,所以就按照裸奔三部曲做,但是烧如arm后,有图片显示,但对我的点击豪无反应,能不能帮我分析下 我也是刚刚做完这个实验,在主函数里添加while(1)循环有错误,搞的我好郁闷,最后就在源出厂程序的touchpanel.c中改成功了 谢谢 ,我也成功了
页:
[1]