Chapter 12
Synchronization
©
National Instruments Corporation
12-19
//Variables for modal error handling
u16
commandID;
// The commandID of the function
u16
resourceID;
// The resource ID
i32
errorCode;
//Get the board ID
printf("Enter the Board ID: ");
scanf("%u", &boardID);
//Get the axis number
printf("Enter a axis number: ");
scanf("%u",&axis);
//Get the Target Position
printf("Enter a target position: ");
scanf("%ld",&targetPos);
//Get the Breakpoint Position
printf("Enter a breakpoint position: ");
scanf("%ld",&bpPos);
//Get the Breakpoint Period
printf("Enter a breakpoint period: ");
scanf("%ld",&bpPer);
//Configure the breakpoint to be absolute
err =
flex_configure_breakpoint
(boardID,axis,NIMC_PERIODI
C_BREAKPOINT,NIMC_NO_CHANGE,0);
CheckError;
//Load the position to start breakpoints
err =
flex_load_pos_bp
(boardID,axis,bpPos,0xFF);
CheckError;
//Set the Period
err =
flex_load_bp_modulus
(boardID,axis,bpPer,0xFF);
CheckError;
//Enable the breakpoint
err =
flex_enable_breakpoint
(boardID,axis,NIMC_TRUE);
CheckError;
//Load a target position
err =
flex_load_target_pos
(boardID,axis,targetPos,0xFF);
CheckError;
//Start the motion
err =
flex_start
(boardID,axis,0);