- 回零的方法有:
- Home at current position
- Home to hard stop
- Home to limit switch
- Home to home switch
- Home to index
- Home to hard stop and index
- Home to limit switch and index
- Home to home switch and index
- 举例
- Home 当前位置
ACSPL+代码:
set FPOS(axis) = 0
或
set RPOS(axis) = 0
或
set A APOS(axis) = 0
- Home at hardstop
! 1. Enable motor
ENABLE (axis)
! 2. Reduce motor current saturations
XCURI(axis) = 5
XCURV(axis) = 5
! 3. Turn off default CPE response
FDEF(axis).#CPE = 0
! 4. Jog towards negative hard stop
JOG/v (axis), -home_velocity
! 5. Detect CPE faultTILL ( FAULT(axis).#CPE = 1 )
! 6. Set home position as current + offset and move to home
SET FPOS(axis) = 0 - home_offset
PTP/ev (axis), 0, home_velocity
! 7. Reset motor current saturations and CPE response
XCURI(axis) = 50
XCURV(axis) = 100
FDEF(axis).#CPE = 1
- Home to Index
ACSPL+程序:
! 1. Enable motor
ENABLE (axis)
! 2. Reset index latch by toggling
IST(axis).#IND = 1
IST(axis).#IND = 0
! 3. Jog in negative direction
JOG/v (axis), -home_velocity
! 4. Detect index
TILL ( IST(axis).#IND = 1 )
! 5. Set home position with optional offset
SET FPOS(axis) = FPOS(axis) - ( IND(axis) - home_offset )
! 6. Move to home position
PTP/e (axis), 0
- home to hardstop and index
ACSPL+程序:
Enable (axis)
XCURI (axis) = 5
XCURV (axis) = 5
FDEF(axis).#CPE = 0
JOG/v (axis), home_velocity
IST(axis).#IND = 1
IST(axis).#IND = 0
TILL ( IST(axis).#IND = 1 )
SET FPOS(axis) = FPOS(axis) - ( IND(axis) - home_offset )
PTP/ev (axis), 0, home_velocity
XCURI(axis) = 50
XCURV(axis) =100
FDEF(axis).#CPE =1
- 其他
- 应用程序示例
int AcsController::home(HANDLE Handle, int axisIndex, ACSC_WAITBLOCK* Wait)
{
char buf[BUFSIZE] = {0};
char tmpAxis[32] = {0};
strcpy_s(buf, "!This is a ACSPL+ program to do home action\n" );
strcat_s(buf, "Global Int iAxisIndex \n" );
sprintf(tmpAxis,"iAxisIndex = %d\n",axisIndex);
strcat_s(buf, tmpAxis);
//1. Enable Motor
strcat_s(buf, "ENABE(iAxisIndex) \n" );
//2. Reduce motor current saturations
strcat_s(buf, "XCURI(iAxisIndex) = 5 \n" );
strcat_s(buf, "XCURV(iAxisIndex) = 5 \n" );
//3. Turn off default CPE response
strcat_s(buf, "FDEF(iAxisIndex).#CPE = 0 \n" );
//4. Jog towards negative hard stop
strcat_s(buf, "JOG/v (iAxisIndex), -home_velocity \n" );
//5. Detect CPE fault
strcat_s(buf, "TILL ( FAULT(iAxisIndex).#CPE = 1 ) \n" );
//6. Jog in oppsite direction, reset index flag, and detect index
strcat_s(buf, "JOG/v (iAxisIndex), home_velocity \n" );
strcat_s(buf, "IST(iAxisIndex).#IND = 1 \n" );
strcat_s(buf, "IST(iAxisIndex).#IND = 0 \n" );
strcat_s(buf, "TILL ( IST(iAxisIndex).#IND = 1 ) \n" );
//7. Set home position with optional offset
strcat_s(buf, "SET FPOS(iAxisIndex) = FPOS(iAxisIndex) - ( IND(iAxisIndex) - home_offset ) \n" );
strcat_s(buf, "PTP/ev (iAxisIndex), 0, home_velocity \n" );
//8. Reset motor current saturation and CPE response
strcat_s(buf, "XCURI(iAxisIndex) = 50 \n" );
strcat_s(buf, "XCURV(iAxisIndex) = 100 \n" );
strcat_s(buf, "FDEF(iAxisIndex).#CPE = 1 \n" );
//9. loadBuffer
if (!loadBuffer(Handle, // communication handle
0, // ACSPL+ program buffer number
buf, // pointer to the buffer containing
// ACSPL+ program(s).
strlen(buf), // size of this buffer
Wait // waiting call
))
{
printf("transaction error: %d\n", acsc_GetLastError());
return -1;
}
//10. compileBuffer
if(!compileBuffer(Handle, 0, NULL))
{
printf("transaction error: %d\n", acsc_GetLastError());
return -2;
}
//11. runBuffer
if(!runBuffer(Handle, 0, NULL, NULL))
{
printf("transaction error: %d\n", acsc_GetLastError());
return -3;
}
return 1;
}