 
#include "config.h"

u8 volatile gu8v_KeyCount;


void fun_Wait_KEY_UP()
{
	gu16_CorrCount=0;
	while(1)
	{
		if(KEY_PORT == 0)
		{		
			gbv_Flag_Key_Lock = 1;	
			gu8v_KeyCount=0x00;
		}
		else if(gbv_Flag_Key_Lock)
		{
			if(KEY_PORT == 1)
			{
				gu8v_KeyCount++;
				if(gu8v_KeyCount > 3)
				{
					gbv_Flag_Key_Lock=0;
					gu8v_KeyCount = 0;
					break;	
				}		
			}
			else
			{
				gu8v_KeyCount = 0;
			}
		}
		gu16_CorrCount++;
		if(gu16_CorrCount > 1000)
		{
			break;
		}
		delay_n_ms(10);
	}
}









