Home return
This instruction performs a home return according to the parameters in the specified DUT.Pulses are output from the specified channel when the control flag for this channel is FALSE and the execution condition is TRUE.
Input
Starting address of area containing the data table
Pulse output channel:0–3
After a drive system has been switched on, there is a difference between the internal position value (elapsed value) and the mechanical position of the axis; this difference cannot be predetermined. The internal value must be synchronized with the actual position value of the axis. This is done by means of a home return, during which a position value is registered at a known reference point (home).During execution of a home return instruction, pulses are continuously output until the home input is enabled. The I/O allocation is determined by the channel used.To decelerate movement when near the home position, designate a near home input and set bit 4 of the special data register storing the pulse output control code (sys_wHscOrPulseControlCode) to TRUE and back to FALSE again.The deviation counter clear output can be set to TRUE when home return has been completed.
Select one of two different operation modes:
Type 0:
The home input is effective regardless of whether or not there is a near home input, whether deceleration is taking place, or whether deceleration has been completed.
Without near home input:
|
With near home input:
|
Type 1: The home input is effective only after deceleration (started by near home input) has been completed.
Use the following predefined DUT: F177_PulseOutput_Home_Type0_DUT or F177_PulseOutput_Home_Type1_DUT
The following parameters can be specified in the DUT:
Control code
Initial speed
Target speed
Acceleration time
Deceleration time
Creep speed
Deviation counter clear signal (output time)
Pulse output characteristics
The pulse output frequency changes according to the specified acceleration time and the specified deceleration time.
The difference between target and initial speed determines the slope of the ramps.
Pulses are output using a duty of 25%.
With the pulse output method "pulse/direction", pulses are output approx. 300ms after the direction signal has been output; the motor driver characteristics are simultaneously taken into consideration.
General programming information
Set "Pulse output" for the desired channel in the system registers.
Even when home input has occurred, executing this instruction causes pulse output to begin.
If the near home input is enabled while acceleration is in progress, deceleration will start.
The deviation counter clear signal is allocated to dedicated output numbers specific to each PLC type.
If both the main program and the interrupt program contain code for the same channel, make sure both are not executed simultaneously.
When a pulse output instruction is executed and pulses are being output, the pulse output control flag (e.g. sys_bIsPulseChannel0Active) of the corresponding channel is TRUE. No other pulse output instruction can be executed as long as this flag is TRUE.
When programs are being edited in RUN mode, pulse output stops but resumes after the program changes have been downloaded.
We strongly recommend that you incorporate a forced stop option in your positioning program.
The status of the high-speed counter control flag or pulse output control flag may change while a scan is being carried out. For example, if the number of received bytes is read more than once different statuses may exist within one scan.
FP0R C16
Channel no. |
Deviation counter clear output |
Home input |
0 | Y6 | X4 |
1 | Y7 | X5 |
2 | – | X6 |
3 | – | X7 |
Inputs X4–X7 can either be used as high-speed counter inputs or as home inputs.
Y6 and Y7 can either be used as pulse outputs for channel 3 or as deviation counter clear outputs for channel 0 and 1.
FP0R C32, T32, F32
Channel no. |
Deviation counter clear output |
Home input |
0 | Y8 | X4 |
1 | Y9 | X5 |
2 | YA | X6 |
3 | YB | X7 |
Inputs X4–X7 can either be used as high-speed counter inputs or as home inputs.
In the global variable list you define variables that can be accessed by all POUs in the project.
The DUT F177_PulseOutput_Home_Type1_DUT is predefined in the “FP library”.
All input and output variables used for programming this function have been declared in the POU header. The same POU header is used for all programming languages.
VAR_EXTERNAL
X0_bMotorSwitch: BOOL:=FALSE;
(*at X0*)
END_VAR
VAR
diInitialSpeed: DINT:=1000;
diTargetSpeed: DINT:=5000;
diAccelerationTime: DINT:=3000;
diDecelerationTime: DINT:=3000;
diCreepSpeed: DINT:=5000;
dutHomeType1: F177_PulseOutput_Home_Type1_DUT:=dwControlCode := 16#0012,
diInitialSpeed := 0,
diTargetSpeed := 0,
diAccelerationTime := 0,
diDecelerationTime := 0,
diCreepSpeed := 0;
(*For ControlCode (16#0012):
1 = Forward
2 = Pulse/Sign forward on*)
@'': @'';
END_VAR
BODY
WORKSPACE
NETWORK_LIST_TYPE := NWTYPELD ;
ACTIVE_NETWORK := 0 ;
END_WORKSPACE
NET_WORK
NETWORK_TYPE := NWTYPELD ;
NETWORK_LABEL := ;
NETWORK_TITLE := ;
NETWORK_HEIGHT := 24 ;
NETWORK_BODY
B(B_CONTACT,,X0_bMotorSwitch,4,1,6,3,R);
B(B_F,E_MOVE!,Instance,17,4,23,8,,?DEN?D?AENO?C);
B(B_F,E_MOVE!,Instance,17,8,23,12,,?DEN?D?AENO?C);
B(B_VAROUT,,dutHomeType1.diTargetSpeed,23,6,25,8,);
B(B_VARIN,,diTargetSpeed,15,6,17,8,);
B(B_VAROUT,,dutHomeType1.diAccelerationTime,23,10,25,12,);
B(B_VARIN,,diAccelerationTime,15,10,17,12,);
B(B_F,E_MOVE!,Instance,17,20,23,24,,?DEN?D?AENO?C);
B(B_VAROUT,,dutHomeType1.diDeviationCounterClearSignalOutputTime,23,22,25,24,);
B(B_VARIN,,0,15,22,17,24,);
B(B_F,E_MOVE!,Instance,17,0,23,4,,?DEN?D?AENO?C);
B(B_VAROUT,,dutHomeType1.diInitialSpeed,23,2,25,4,);
B(B_VARIN,,diInitialSpeed,15,2,17,4,);
B(B_F,E_MOVE!,Instance,17,12,23,16,,?DEN?D?AENO?C);
B(B_VAROUT,,dutHomeType1.diDecelerationTime,23,14,25,16,);
B(B_VARIN,,diDecelerationTime,15,14,17,16,);
B(B_F,E_MOVE!,Instance,17,16,23,20,,?DEN?D?AENO?C);
B(B_VAROUT,,dutHomeType1.diCreepSpeed,23,18,25,20,);
B(B_VARIN,,diCreepSpeed,15,18,17,20,);
L(7,2,7,6);
L(1,2,4,2);
L(6,2,7,2);
L(7,2,17,2);
L(7,6,17,6);
L(7,10,17,10);
L(7,6,7,10);
L(7,10,7,22);
L(7,22,17,22);
L(7,14,17,14);
L(7,18,17,18);
L(1,0,1,24);
END_NETWORK_BODY
END_NET_WORK
NET_WORK
NETWORK_TYPE := NWTYPELD ;
NETWORK_LABEL := ;
NETWORK_TITLE := ;
NETWORK_HEIGHT := 12 ;
NETWORK_BODY
B(B_CONTACT,,X0_bMotorSwitch,8,5,10,7,R);
B(B_VARIN,,dutHomeType1,15,6,17,8,);
B(B_VARIN,,0,15,7,17,9,);
B(B_COMMENT,,Example for home position return,1,2,18,4,);
B(B_F,F177_PulseOutput_Home!,Instance,17,4,30,9,,?DEN?Ds_dutDataTable?Hn_iPulseOutputChannel?AENO);
L(10,6,17,6);
L(1,6,8,6);
L(1,0,1,12);
END_NETWORK_BODY
END_NET_WORK
END_BODY
IF DF(X0_bMotorSwitch) then
dutHomeType1.diInitialSpeed:=diInitialSpeed;
dutHomeType1.diTargetSpeed:=diTargetSpeed;
dutHomeType1.diAccelerationTime:=diAccelerationTime;
dutHomeType1.diDecelerationTime:=diDecelerationTime;
dutHomeType1.diCreepSpeed:=diCreepSpeed;
dutHomeType1.diDeviationCounterClearSignalOutputTime:=0;
END_IF;
(*Example for home position return*)
IF DF(X0_bMotorSwitch) then
F177_PulseOutput_Home(s_dutDataTable := dutHomeType1,
n_iPulseOutputChannel := 0);
END_IF;