05-23-2007 10:38 AM
{
status = flex_start(BOARD_ID, axis,
0 ); if( status != NIMC_noError ){
error =
true;printf(
"flex_start()\n");nimcHandleError(&status);
}
}
////////////////////////////////////////////////// // // Wait until the motor move completes // if( !error ){
status = WaitDone( &error, axis );
if( status != NIMC_noError ){
error =
true;printf(
"WaitDone()\n");nimcHandleError(&status);
}
}
/****************************************************************
**
** WaitDone
**
** PURPOSE: Wait for a move to complete
**
** PASS: Nothing
**
** RETURN: FLEXFUNC containing status
**
** NOTES:
**
***************************************************************/
FLEXFUNC WaitDone(
bool *error, u8 axis ){
int i = 0;u16 axisStatus;
u16 moveComplete;
i32 status, encoder_counts, position;
do{
i++;
//printf("%i\n", i);axisStatus =
0;moveComplete =
0; // Check the move complete status if( !(*error) ){
status = flex_check_move_complete_status(BOARD_ID, axis,
0, &moveComplete); if( status != NIMC_noError ){
*error =
true;printf(
"flex_check_move_complete_status()\n");}
}
if( !(*error) ){
status = flex_read_axis_status_rtn(BOARD_ID, axis, &axisStatus);
if( status != NIMC_noError ){
*error =
true;printf(
"flex_read_axis_status_rtn()\n");}
}
if( !(*error) ){
status = flex_read_encoder_rtn(BOARD_ID, (u8)(axis+ENC_OFFSET), &encoder_counts);
status = flex_read_pos_rtn(BOARD_ID, axis, &position);
if( status != NIMC_noError ){
*error =
true;printf(
"flex_read_encoder_rtn()\n");printf(
"flex_read_pos_rtn()\n");}
printf(
"Ecoder 0X%0X:\t%05i\tPos: %05i\r", (u8)(axis+ENC_OFFSET), encoder_counts, position ); //printf("Ecoder 0X%0X:\t%05i\r", (axis+ENC_OFFSET), i );}
Sleep(
50);}
while( !moveComplete && !(*error) &&!( axisStatus & NIMC_FOLLOWING_ERROR_BIT ) &&
!( axisStatus & NIMC_AXIS_OFF_BIT ));
printf(
"\n"); return status;}
<End Snippet>
The motor moves as expected. I get no change in encoder_counts. position displays as expected.
I'm sure there can be a whole host of reasons for this. I suspect it is a wiring issue. Is there anyhting in the configuration or set up I could be missing?
Any Thoughts?
Chris
05-23-2007 10:51 AM - edited 05-23-2007 10:51 AM
Message Edité par JB le 05-23-2007 05:52 PM
05-23-2007 12:13 PM
05-24-2007 01:32 AM
05-24-2007 06:54 AM
As I thought.
We were able to successfully read the encoder. I was an wiring problem.