F171_PulseOutput_Trapezoidal

Trapezoidal Control

This instruction automatically performs trapezoidal control 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

s_dutDataTable (DUT)

Starting address of area containing the data table

  • FP-S, FP-X:

    F171_PulseOutput_Trapezoidal_DUT

  • FP0R:

    F171_PulseOutput_Trapezoidal_Type0_DUT

    F171_PulseOutput_Trapezoidal_Type1_DUT

n_iPulseOutputChannel (decimal constant)

Pulse output channel:

FP-XH C30 T/P: 0–3

FP-XH C60 T/P: 0–5

FP-S0, 2

FP-X R0, 1

FP-XC14T0, 1, 2

FP-X C30T/C60T0, 1, 2, 3

FP0R0, 1, 2, 3

Description for FP-Sigma, FP-X

Use the following predefined DUT: F171_PulseOutput_Trapezoidal_DUT.

The following parameters can be specified in the DUT:

  • Control code
  • Initial and final speed
  • Target speed
  • Acceleration/deceleration time
  • Target value
  • Pulse stop
Pulse output characteristics
  1. Initial and final speed

  2. Target speed

  3. Acceleration/deceleration time

  4. Target value

  5. Pulse output control flag

  6. Execution condition

The pulse output frequency changes according to the specified acceleration/deceleration time.The difference between target and initial speed determines the slope of the ramps.

  • If both the main program and the interrupt program contain code for the same channel, make sure both are not executed simultaneously.
  • FP-X: 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.

  • FPS: The high-speed counter control flag (e.g. sys_bIsHscChannel0ControlActive) and the pulse output control flag (e.g. sys_bIsPulseChannel0Active) are assigned to the same special internal flag number (e.g. R903A). Therefore, when a high-speed counter instruction or a pulse output instruction is executed, both the high-speed counter control flag (e.g. sys_bIsHscChannel0ControlActive) and the pulse output control flag (e.g. sys_bIsPulseChannel0Active) for the channel used are TRUE. No other high-speed counter instruction or pulse output instruction can be executed as long as this flag is TRUE.

  • FPS: Executing the circular interpolation control instruction F176_PulseOutput_Center sets the circular interpolation control flag (sys_bIsCircularInterpolationActive) to TRUE. The status of this flag is maintained until the target value is reached (even if the execution condition is no longer TRUE). During this time, other pulse output instructions cannot be executed.

  • When programs are being edited in RUN mode, pulse output stops but resumes after the program changes have been downloaded.
  • FPS: Set any high-speed counter allocated to a pulse output channel to "Unused" in the system registers.

  • FP-X: Set "Pulse output" for the desired channel in the system registers.

  • 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.

Description for FP0R

Use the following predefined DUT: F171_PulseOutput_Trapezoidal_Type0_DUT (maximum speed = first target speed) or F171_PulseOutput_Trapezoidal_Type1_DUT (maximum speed = 50kHz).

The target speed can be changed during pulse output.

Two control methods are available:

  • Type 0: The speed can be changed within the range of the target speed specified first.

  • Type 1: The speed can be changed within the range of the maximum speed (50kHz).

The following parameters can be specified in the DUT:

  • Control code
  • Initial and final speed
  • Target speed
  • Acceleration time
  • Deceleration time
  • Target value

Pulse output characteristics

  1. Initial and final speed

  2. Target speed

  3. Acceleration time

  4. Deceleration time

  5. Target value

  6. Pulse output control flag

  7. Execution condition

  8. Decelerated stop request

  • Type 0:

    The difference between target speed and initial speed determines the slope of the acceleration ramp.The difference between target speed and final speed determines the slope of the deceleration ramp.

  • Type 1:

    The difference between the maximum speed of 50kHz and the initial speed determines the slope of the acceleration ramp.The difference between the maximum speed of 50kHz and the final speed determines the slope of the deceleration ramp.

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.

Decelerated stop

To perform a decelerated stop, set bit 5 of the data register storing the pulse output control code from FALSE to TRUE (e.g. MOVE(16#120, sys_wHscOrPulseControlCode);).When a decelerated stop is requested during acceleration, deceleration is performed with the same slope as deceleration from the target speed.

Changing the target speed during pulse output

Type 1: The speed can be changed within the range of the maximum speed (50kHz).

  1. Target speed

  2. 1st change of target speed

  3. 2nd change of target speed

  4. Acceleration time

  5. Acceleration

  6. Deceleration

  7. Deceleration time

  8. Pulse output control flag

  9. Execution condition

To change the speed, keep the execution condition TRUE.

  • Type 0:

    If a value larger than the target speed at start-up is specified, it will be corrected to the target speed at start-up.

  • Type 1:

    If the target speed is set to a value larger than 50kHz, it will be corrected to 50kHz.

If the elapsed value crosses over the acceleration forbidden area starting position (e.g. sys_diPulseChannel0AccelerationForbiddenAreaStartingPosition) during acceleration, acceleration cannot be performed.

  • The deceleration speed cannot be lower than the corrected final speed.

  • As soon as you begin editing a program online (i.e., in RUN mode) using this instruction, pulse output will stop.

  • 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.
  • The instruction cannot be started when a decelerated stop has been requested.
  • To restart after stopping the operation, turn the execution condition to FALSE and then to TRUE again.
  • The execution of the instruction is faster the second time it is started if the positioning parameters remain unchanged. Changing the setting of the output operation (pulse output or calculation only) does not effect this behavior.
  • 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.

Example

POU header

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
		bMotorSwitch: BOOL:=FALSE;
		dutTrapez: F171_PulseOutput_Trapezoidal_DUT:=dwControlCode := 16#1100;
			(*Control code:
Digit 3: 1=Duty ratio 25%
Digit 2: 1=Frequency range 48Hz-100kHz
Digit 1: 0=Relative value control
Digit 0: 0=CW/CCW*)
	END_VAR
	VAR_EXTERNAL
		X0_bMotorSwitch: BOOL:=FALSE;
			(*at X0*)
	END_VAR
	VAR 
		diInitialSpeed: DINT:=100;
		diTargetSpeed: DINT:=2000;
		diAccelerationTime: DINT:=300;
		diTargetValue: DINT:=10000;
		@'': @'';
	END_VAR

LD body

BODY
    WORKSPACE
        NETWORK_LIST_TYPE := NWTYPELD ;
        ACTIVE_NETWORK := 0 ;
    END_WORKSPACE
    NET_WORK
        NETWORK_TYPE := NWTYPELD ;
        NETWORK_LABEL :=  ;
        NETWORK_TITLE :=  ;
        NETWORK_HEIGHT := 16 ;
        NETWORK_BODY
B(B_CONTACT,,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,,dutTrapez.diTargetSpeed,23,6,25,8,);
B(B_VARIN,,diTargetSpeed,15,6,17,8,);
B(B_VAROUT,,dutTrapez.diAccelerationAndDecelerationTime,23,10,25,12,);
B(B_VARIN,,diAccelerationTime,15,10,17,12,);
B(B_F,E_MOVE!,Instance,17,12,23,16,,?DEN?D?AENO?C);
B(B_VAROUT,,dutTrapez.diTargetValue,23,14,25,16,);
B(B_VARIN,,diTargetValue,15,14,17,16,);
B(B_F,E_MOVE!,Instance,17,0,23,4,,?DEN?D?AENO?C);
B(B_VAROUT,,dutTrapez.diInitialAndFinalSpeed,23,2,25,4,);
B(B_VARIN,,diInitialSpeed,15,2,17,4,);
L(7,2,7,6);
L(7,6,7,10);
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,10,7,14);
L(7,14,17,14);
L(1,0,1,16);
        END_NETWORK_BODY
    END_NET_WORK
    NET_WORK
        NETWORK_TYPE := NWTYPELD ;
        NETWORK_LABEL :=  ;
        NETWORK_TITLE :=  ;
        NETWORK_HEIGHT := 6 ;
        NETWORK_BODY
B(B_CONTACT,,bMotorSwitch,4,2,6,4,R);
B(B_VARIN,,dutTrapez,14,3,16,5,);
B(B_VARIN,,0,14,4,16,6,);
B(B_F,F171_PulseOutput_Trapezoidal!,Instance,16,1,31,6,,?DEN?Ds_dutDataTable?Hn_iPulseOutputChannel?AENO);
L(6,3,16,3);
L(1,3,4,3);
L(1,0,1,6);
        END_NETWORK_BODY
    END_NET_WORK
END_BODY

ST body

IF DF(bMotorSwitch) then
  dutTrapez.diInitialAndFinalSpeed:=diInitialSpeed;
  dutTrapez.diTargetSpeed:=diTargetSpeed;
  dutTrapez.diAccelerationDecelerationTime:=diAccelerationTime;
  dutTrapez.diDeviationCounterClearSignalOutputTime:=10;
END_IF;
IF DF(bMotorSwitch) then
  F171_PulseOutput_Trapezoidal(s_dutDataTable := dutTrapez,
        n_iPulseOutputChannel :=0);
END_IF;

Modified on: 2022-03-02Feedback on this pagePanasonic hotline