⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 recover.txt

📁 LED的逆向应用:触摸感应-11.9M.zip
💻 TXT
字号:
	/* ISP有影响,除去下载线,效果ok */
	/* 开背景光 Turn ON*/
	_ledsAnode_High(LEDS1);/* 阳极 */
	_ledsCathode_ChangeToOutputLow(LEDS1);/* 阴极 */
	/* 反向偏执 充电 */
	_ledsAnode_Low(LEDS0);
	_ledsCathode_ChangeToOutputHig(LEDS0);
	_runTimer0_TimeUS(250);
	_waitTimer0OV();
	_runTimer0_TimeUS(250);
	_waitTimer0OV();
	/* 反向偏执 检测光 */
	_ledsCathode_ReadIO_Hi_Z(LEDS0);
	_runTimer0_TimeUS(250);
	_waitTimer0OV();
	_runTimer0_TimeUS(250);
	_waitTimer0OV();

	suart_Byte(ReadPinsAsLowInTimePeriod(LEDS0ADDR));
	_ledsAnode_Low(LEDS1);/* 阳极 Turn OFF*/




unsigned char ReadLedPinAsLowInTimePeriod(unsigned int addrPin,unsigned char bitVal) 
{	unsigned char i;
	static unsigned char RdVal;
	unsigned char lowerThresholdCnt=0;

	for(i = 0 ; i < 5 ; i++)
	{	_runTimer0_TimeUS(100);
		do
		{	_breakTimer0OV();
			RdVal = (*(volatile unsigned char *)(addrPin));
			
			/*_ledsCathode_Pin(addrPin);通过SRAM读取端口,程序可扩展*/
		}while(  !(RdVal & bitVal) );/*_breakTimer0OV() 读取引脚1,检测到高电平 下一步*/
		/* 开始新检测周期 */
		//if(!(RdVal & bitVal)){continue;}/* 0 for-continue */
		_runTimer0_TimeUS(250);
		do
		{	RdVal = (*(volatile unsigned char *)(addrPin));
			
			if( !(RdVal & bitVal) )/* 读取引脚0,检测到低电平 */
			{
				lowerThresholdCnt++; 
				break;
			}
	
		}_whileTimer0OV();

	}
	//if(lowerThresholdCnt >= 3)return 1;
	//else return 0;
	return lowerThresholdCnt;
}










		if((mercurySwitch == (char)(0-(MER_SWC_NUM/2)) ) && (SYSFLAG.merSwitch == 1))
		{
			SYSFLAG.merSwitch = 0;
			    = 1;
			suart_Byte(('0'+SYSFLAG.merSwitch));
		}
		else if((mercurySwitch == (MER_SWC_NUM/2) ) && (SYSFLAG.merSwitch == 0))
		{
			SYSFLAG.merSwitch = 1;
			SYSFLAG.left2right =1;
			suart_Byte(('0'+SYSFLAG.merSwitch));
		}
		if(SYSFLAG.left2right == 0)/* 方向保持 */
		{	if(gCnt >= 0 && gCnt< LINE_NUM}
			{	if(SYSFLAG.merSwitch == 1)
				{	ledsTurnOn(valUnPack(gDotArr[gCnt++].i16));
				}else
				{
					ledsTurnOn(valUnPack(gDotArr[gCnt--].i16));
				}
			}
			if(gCnt >=  LINE_NUM){gNullLedsOn++;continue;}
			if(gCnt == 255){gNullLedsOn++;continue;}
		}else/* 方向切换后 */
		{	gNullLedsOn--;/*空显示区域忽略*/
			if(gNullLedsOn <= 2)
			{	SYSFLAG.left2right = 0;
				
			}
			_ledsAnode_Low(LEDS0);
			_ledsAnode_Low(LEDS1);
			continue;
		}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -