Exemple #1
0
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
}
Exemple #2
0
void ENCStep(unsigned char Channel, int *position)
{
#if (!defined MATLAB_MEX_FILE) && (!defined MDL_REF_SIM_TGT)
	*position = eqep_get(Channel);
#endif
}