Chapter 5
Straight-Line Moves
©
National Instruments Corporation
5-15
do
{
//
Check the following error/axis off status
err =
flex_read_axis_status_rtn
(boardID, axis,
&axisStatus);
CheckError;
//
Read the communication status register and
check the modal
//
errors
err =
flex_read_csr_rtn
(boardID, &csr);
CheckError;
//
Check the modal errors
if
(csr & NIMC_MODAL_ERROR_MSG)
{
err = csr & NIMC_MODAL_ERROR_MSG;
CheckError;
}
//
Get the current time and check if time is over
for the
first
//
segment
currentTime = timeGetTime();
if
((currentTime - initialTime) >= moveTime1)
break;
Sleep (100); //
Check every 100 ms
}
while
(!(axisStatus) && !(axisStatus &
NIMC_FOLLOWING_ERROR_BIT) && !(axisStatus &
NIMC_AXIS_OFF_BIT)); //
Exit on following error/axis
off
//-------------------------------------------------
//
Second segment
//-------------------------------------------------
//
Set the velocity for the move (in counts/sec)
err =
flex_load_velocity
(boardID, axis, 6568, 0xFF);
CheckError;
//
Start the move - to update the velocity
err =
flex_start
(boardID, axis, 0);
CheckError;
//
Wait for the time for second segment
initialTime = timeGetTime();
do
{
//
Check the following error/axis off
status
err =
flex_read_axis_status_rtn
(boardID, axis,
&axisStatus);