![SEW-Eurodrive IPOS plus Скачать руководство пользователя страница 260](http://html1.mh-extra.com/html/sew-eurodrive/ipos-plus/ipos-plus_manual_1250042260.webp)
260
Manual – IPOSplus®
18
Touch probe interrupt processing
Compiler – Examples
SSPOSSPEED tPosSpeed;
SSPOSRAMP tPosRamp;
/*=============================================
Interruptroutine Touchprobe
===============================================*/
Touchprobe()
{
lPosition = TpPo TP_Pos; //calculate new target position
_TouchProbe( TP_DIS1 ); //Deactivate touch probe
}
/*=============================================
Main function (IPOS initial function)
===============================================*/
main()
{
//Initialization
State = 0;
// Initialization of the interrupt routine for touch probe input DI02
_SetInterrupt( SI_TOUCHP1,Touchprobe );
//Main program loop
while(1)
{
// Set speed and ramp
tPosSpeed.CW = tPosSpeed.CCW = Speed *10; // Speed
tPosRamp.Up = tPosRamp.Down = Ramp; // Ramp
_SetSys (SS_POSRAMP, tPosRamp);
_SetSys (SS_POSSPEED, tPosSpeed);
switch(State)
{
case CALCTARGET: if(DI10)
{
lPosition = ActP TP_Max_Pos;
_TouchProbe( TP_EN1_HI );
// Activate rising edge
State = BUSSY;
}
break;
case BUSSY: _GoAbs( GO_NOWAIT,lPosition );
// _Go command to position
if(h473_ipos_in_position && !DI10)
// Axis in position and DI10 = 0
State = CALCTARGET; // Calculate new target position
if (!h473_ipos_in_position && !DI10)
// Positioning cancelled by DI10 = 0
{
_AxisStop(AS_PSTOP);
State = STOP_AKTIV;
}
break;
case STOP_AKTIV: if(DI10) // DI10 = 1 --> Continue positioning
break;
State = BUSSY;
default: break;
}//switch(State)
}// while (1)
}// main
P
i
f
kVA
Hz
n
P
i
f
kVA
Hz
n