예제 #1
0
파일: mdaqenc.c 프로젝트: kyak/microdaq_ert
void ENCStep(unsigned char Channel, int *position, unsigned char *dir, unsigned char reset)
{
#if (!defined MATLAB_MEX_FILE) && (!defined MDL_REF_SIM_TGT)
	static int pos_prev; 
	if ( reset != 0 ) 
	{
		eqep_init(Channel);
		*dir = 0; 
		*position = 0; 
		pos_prev = 0; 
		return;
	}

	*position = eqep_get(Channel);
	if ( pos_prev < *position )  
	{
		*dir = 1; 
	}
	else if (pos_prev > *position ) 
	{
		*dir = 2; 
	}
	else 
		*dir = 0; 

	pos_prev = *position; 
#endif
}
예제 #2
0
void ENCStep(unsigned char Channel, int *position)
{
#if (!defined MATLAB_MEX_FILE) && (!defined MDL_REF_SIM_TGT)
	*position = eqep_get(Channel);
#endif
}