问题1:
请问在WINCE50下中断处理过程是怎么样的?
通过打印信息我发现我的BSPIntrActiveIrq先被调用,然后调用BSPIntrDoneIrq,最后调用BSPIntrEnableIrq。
BSPIntDisableIrq并没有被调用
请问这个现象对吗??
问题2:
现在的现象是采样的X、Y两点值并不对
for(i=0;i
{
rgPointSamples.XSample = getTouchCoordinate(WM97_ADC_X);
rgPointSamples.YSample = getTouchCoordinate(WM97_ADC_Y);
}
程序中连采3次,但是只有第一次值是正确的第二次和第三次都是4095
请问这个问题原因是什么呢?
整个TOUCH的驱动都是在以前能用的BSP中移植过来的
AC97驱动略有不同(对TOUCH用到的地方好象没有什么不同)
只有中断非常不一样
麻烦各位帮我分析一下!谢谢!
static USHORT getTouchCoordinate(UINT axis)
{
USHORT sample=MAX_ADC_VAL; // the maximum ADC output
BOOL noError = FALSE;
unsigned long adcDataReg;
DEBUGMSG(ZONE_FUNCTION,(TEXT("+getTouchCoordinate\r\n")));
AC97ReadReg(WM97_DIGITISER_DATA,
&adcDataReg);
if(adcDataReg & WM97_DATA_PENDOWN)
{
noError = sampleADC(&sample,axis);
}
DEBUGMSG(ZONE_FUNCTION,(TEXT("-getTouchCoordinate\r\n")));
return sample;
}
由这个函数可以看出if(adcDataReg & WM97_DATA_PENDOWN) 条件不满足时USHORT sample=MAX_ADC_VAL; // the maximum ADC output
函数的返回值就是MAX_ADC_VAL = 0xfff = 4095,所以应该是你的pendown状态有问题
我的此函数为:
USHORT getTouchCoordinate(unsigned axis)
{
//WX_change locked
HANDLE hMutex;
DWORD dwWaitMutex;
//DWORD g_MutexWaitTime=3000;
RETAILMSG(1, (TEXT("TOUCH getTouchCoordinate is Running!!\r\n")));
hMutex = CreateMutex(NULL,FALSE,TEXT("AClinkOfMutexObject"));
if(NULL==hMutex)
{
return FALSE;
}
dwWaitMutex=WaitForSingleObject(hMutex,INFINITE);
USHORT sample = MAX_ADC_VAL;
USHORT adcData;
ReadAC97 (0x7A, &adcData);
unsigned int acsimpletime=1;
if(adcData & WM97_DATA_PENDOWN)
{
ReadAC97 (0x76, &adcData);
adcData |= WM97_TOUCHCTRL1_POLL;
adcData &= ~WM97_TOUCHCTRL1_DEL_MASK;
adcData |= WM97_TOUCHCTRL1_DEL_6;
adcData &= ~WM97_TOUCHCTRL1_ADR_MASK;
adcData |= (axis == WM97_ADC_X ? WM97_TOUCHCTRL1_ADR_X : WM97_TOUCHCTRL1_ADR_Y);
WriteAC97(0x76, adcData);
do
{
ReadAC97 (0x76, &adcData);
//WX_change
//Sleep(1);
NdisStallExecution(1);
} while(adcData & WM97_DATA_PENDOWN);
ReadAC97 (0x7A, &adcData);
sample = adcData & WM97_DATA_VAL;
}
ReleaseMutex(hMutex);
return sample;
}
请问pendown状态是在哪里定义的?
引用: 引用 5 楼 wangxin_801115 的回复:
我的此函数为:
USHORT getTouchCoordinate(unsigned axis)
{
//WX_change locked
HANDLE hMutex;
DWORD dwWaitMutex;
//DWORD g_MutexWaitTime=3000;
RETAILMSG(1, (TEXT("TOUCH getTouchCoordinate is Running!!\r\n")));
? ? hMutex = CreateMutex(NULL,FALSE,TEXT("AClinkOfMutexObject"));
if(NULL==hMutex)
{
return FALSE;
}
? ? dwWaitMutex=WaitForSingleObject(hMutex,INFINITE);
USHORT sample? = MAX_ADC_VAL;
USHORT adcData;
? ? ReadAC97 (0x7A, &adcData);
? ? unsigned int acsimpletime=1;
if(adcData & WM97_DATA_PENDOWN)
{
ReadAC97 (0x76, &adcData);
adcData |=? WM97_TOUCHCTRL1_POLL;
adcData &= ~WM97_TOUCHCTRL1_DEL_MASK;
adcData |=? WM97_TOUCHCTRL1_DEL_6;
adcData &= ~WM97_TOUCHCTRL1_ADR_MASK;
adcData |=? (axis == WM97_ADC_X ? WM97_TOUCHCTRL1_ADR_X : WM97_TOUCHCTRL1_ADR_Y);
WriteAC97(0x76,? adcData);
do
{
ReadAC97 (0x76, &adcData);
//WX_change
//Sleep(1);
? ? ? ? ? ? NdisStallExecution(1);
? ? ? } while(adcData & WM97_DATA_PENDOWN);
ReadAC97 (0x7A, &adcData);
sample = adcData & WM97_DATA_VAL;
}
? ? ReleaseMutex(hMutex);
return sample;
}
请问pendown状态是在哪里定义的?
pendown状态不是哪定义的,是你点击触摸屏后,9712自己把寄存器置上的,前提就是你把触摸的相关寄存器配置正确