Writing the pulse output control code

The special data register where the high-speed counter and pulse output control code are stored can be accessed with the system variable sys_wHscOrPulseControlCode. (The system variable sys_wHscOrPulseControlCode corresponds to special data register DT90052.)

Operations performed by the pulse output control code:

The control code settings for each channel can be monitored using the system variables sys_wHscChannelxControlCode or sys_wPulseChannelxControlCode (where x=channel number).The settings of this system variable remain unchanged until another setting operation is executed.
NOTE
  • Performing a forced stop may cause the elapsed value at the PLC output side to differ from the elapsed value at the motor input side. Therefore, you must execute a home return after pulse output has stopped.
  • Setting the near home input is not possible if counting is prohibited or if a software reset is performed.

Setting/resetting near home input

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 near home bit is retained. Set this bit to FALSE right after setting it to TRUE to be able to set the near home input a second time during a home return.

  1.  (1) Initial and final speed
  2.  (2) Target speed
  3.  (3) Near home input: TRUE
  4.  (4) Home input: TRUE
  5.  (5) Home input is effective at any time.

Continuing/stopping pulse output (forced stop)

By setting bit 3 of the data register storing the pulse output control code (sys_wHscOrPulseControlCode) to TRUE pulse output is stopped. The possibility of a forced stop should be provided for in every program using pulse output instructions. Reset bit 3 to FALSE to continue pulse output.

Enabling/disabling counting operations

Y*

Pulse output

(1)

Elapsed value

(2)

1

When bit 1 of the control code is set to TRUE, counting is prohibited and the elapsed value keeps its current value. Counting is continued when bit 1 is reset to FALSE.

Resetting the elapsed value (software reset) of the high-speed counter

Y*

Pulse output

(1)

Elapsed value

(2)

Bit 0 of pulse output control code (software reset)

When bit 0 of the control code is set to TRUE, a software reset is performed and the elapsed value is set to 0. The elapsed value keeps the value 0 until bit 0 is reset to FALSE.

Cancelling high-speed counter and position control instructions (FP0R only)

To cancel execution of a pulse output instruction, set bit 2 of the data register storing the pulse output control code (sys_wHscOrPulseControlCode) to TRUE. The pulse output control flag will then change to FALSE. To reenable execution of the instruction, reset bit 2 to FALSE.

Description for FP-Sigma

Bits 0–15 of the control code are allocated in groups of four. The bit setting in each group is represented by a hex number (e.g. 00020000 0000 1001 = 16#2009).

Group IV

(1)

Channel number (channel n: 16#n)

Group III

0 (fixed)

Group II

(2)

Near home input (bit 4)

0: FALSE

1: TRUE

Group I

(3)

Pulse output (bit 3)

0: continue

1: stop

(4)

0 (bit 2, fixed)

(5)

Count (bit 1)

0: permit

1: prohibit

(6)

Reset elapsed value to 0 (bit 0)

0: no

1: yes

Example: 16#2009

Group

Value

Description

IV

2

Channel number: 2

III

0

(fixed)

II

0

Near home input: FALSE

I

9

Hex 9 corresponds to binary 1001

Pulse output: stop (bit 3)

1

(bit 2, fixed)

0

Count: permit (bit 1)

0

Reset elapsed value to 0: yes (bit 0)

1

Description for FP-X

Group IV

(1)

Channel number (channel n: 16#n)

Group III

(2)

1 (fixed)

Group II

(3)

Near home input (bit 4) (see note)

0: FALSE

1: TRUE

Group I

(4)

Pulse output (bit 3)

0: continue

1: stop

(5)

Count (bit 1)

0: permit

1: prohibit

(6)

Reset elapsed value to 0 (bit 0)

0: no

1: yes

Example: 16#2109

Group

Value

Description

IV

2

Channel number: 2

III

1

(fixed)

II

0

Near home input: FALSE

I

9

Hex 9 corresponds to binary 1001

Pulse output: stop (bit 3)

1

(Bit 2 fixed)

0

Count: permit (bit 1)

0

Reset elapsed value to 0: yes (bit 0)

1

Description for FP0R

Bits 0–15 of the control code are allocated in groups of four. The bit setting in each group is represented by a hex number (e.g. 00020001 0000 1001 = 16#2109).

Group IV

(1)

Channel number (channel n: 16#n)

Group III

1 (fixed)

Group II

(2)

Position control start request

0: disabled

1: enabled

(3)

Decelerated stop request

0: disabled

1: enabled

(4)

Near home input (bit 4) (see note)

0: FALSE

1: TRUE

Group I

(5)

Pulse output (bit 3)

0: continue

1: stop

(6)

Cancel pulse output control (bit 2)

0: continue

1: stop

(7)

Count (bit 1)

0: permit

1: prohibit

(8)

Reset elapsed value to 0 (bit 0)

0: no

1: yes

Example: 16#2109

Group

Value

Description

IV

2

Channel number: 2

III

1

(fixed)

II

0

Position control start request: disabled

Decelerated stop request: disabled

Near home input: FALSE

I

9

Hex 9 corresponds to binary 1001

Pulse output: stop (bit 3)

1

Cancel pulse output control (bit 2)

0

Count: permit (bit 1)

0

Reset elapsed value to 0: yes (bit 0)

1

Description for FP0, FP-e

Bits 0–15 of the control code are allocated in groups of four, each group containing the settings for one channel. The bit setting in each group is represented by a hex number (e.g. 0000 0000 1001 0000 = 16#90).

Group

II

I

Channel

1

0

  1.  (1) Pulse output (bit 3)

    0: continue

    1: stop

  2.  (2) Near home input (bit 2) (see note)

    0: FALSE

    1: TRUE

  3.  (3) Count (bit 1)

    0: permit

    1: prohibit

  4.  (4) Reset elapsed value to 0 (bit 0)

    0: no

    1: yes

Example: 16#90

Group

Value

Description

II

9

Channel number: 1

Hex 9 corresponds to binary 1001

Pulse output: stop (bit 3)

1

Near home input: FALSE (bit 2)

0

Count: permit (bit 1)

0

Reset elapsed value to 0: yes (bit 0)

1

I

0

Example: enable the near home input for channel 2 (FP-SIGMA)

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
	 bEnableNearHome: BOOL:=FALSE;
	END_VAR
	VAR CONSTANT
		PLS_CH2_ENABLE_NEAR_HOME: WORD:=16#2010;
			(*Enables near home input for channel 2*)
		PLS_CH2_CONTINUE: WORD:=16#2000;
			(*Disables near home input for channel 2
and starts deceleration*)
	END_VAR

LD body

The near home input is enabled for channel 2 during home return operations.

BODY
    WORKSPACE
        NETWORK_LIST_TYPE := NWTYPELD ;
        ACTIVE_NETWORK := 0 ;
    END_WORKSPACE
    NET_WORK
        NETWORK_TYPE := NWTYPELD ;
        NETWORK_LABEL :=  ;
        NETWORK_TITLE :=  ;
        NETWORK_HEIGHT := 8 ;
        NETWORK_BODY
B(B_VARIN,,PLS_CH2_ENABLE_NEAR_HOME,20,2,22,4,);
B(B_VARIN,,PLS_CH2_CONTINUE,20,6,22,8,);
B(B_F,E_MOVE!,Instance,22,0,28,4,,?DEN?D?AENO?C);
B(B_VAROUT,,sys_wHscOrPulseControlCode,28,2,30,4,);
B(B_F,E_MOVE!,Instance,22,4,28,8,,?DEN?D?AENO?C);
B(B_VAROUT,,sys_wHscOrPulseControlCode,28,6,30,8,);
B(B_CONTACT,,bEnableNearHome,4,1,6,3,R);
L(7,2,7,6);
L(1,2,4,2);
L(6,2,22,2);
L(7,6,22,6);
L(1,0,1,8);
        END_NETWORK_BODY
    END_NET_WORK
END_BODY

ST body

if DF(bEnableNearHome) then
    PLS_CH2_ENABLE_NEAR_HOME:=sys_wHscOrPulseControlCode;
    PLS_CH2_CONTINUE:=sys_wHscOrPulseControlCode;
end_if;

Example: performing a forced stop for channel 0 (FP0, FP-e, FP-SIGMA)

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.

LD body

A forced stop of the pulse output is performed for channel 0.

ST body

if DF(bStopPulseOutput) then
    PLS_CH2_STOP_PULSE_OUTPUT:=sys_wHscOrPulseControlCode;
    PLS_CH2_CONTINUE:=sys_wHscOrPulseControlCode;
end_if;
NOTE

Performing a forced stop may cause the elapsed value at the PLC output side to differ from the elapsed value at the motor input side. Therefore, you must execute a home return after pulse output has stopped.

Modified on: 2019-01-25Feedback on this pagePanasonic hotline