LSR

Left shift register

Shifts 1 bit of the specified data area d_WR to the left (to the higher bit position). When programming the LSR instruction, be sure to program the data input DataInput, shift ShiftLeftTrigger and reset triggers Reset.

NOTE
  • The area available for this instruction is only the word internal relay (WR).

  • Word internal relay (WR) number range, depends on the free area under “Extras” > “Options” > “Compile options” > “Address ranges”.

Parameters

Input

DataInput (BOOL)

Specifies the state of new shift-in data:

  • new shift-in data 1: when the input is ON

  • new shift-in data 0: when the input is OFF

ShiftLeftTrigger (BOOL)

Shifts 1 bit to the left when the leading edge of the trigger is detected

Reset (BOOL)

Turns all the bits of the data area to 0 if the trigger is in the ON-state

Output

d_WR (WORD, INT, UINT)

Specified data area where data shift takes place

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
		Output: INT:=0;
		DataInput: BOOL:=FALSE;
		ShiftTrigger: BOOL:=FALSE;
		ResetTrigger: BOOL:=FALSE;
	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 := 5 ;
        NETWORK_BODY
B(B_F,LSR!,Instance,10,0,20,5,,?DDataInput?DShiftLeftTrigger?DReset?Cd_WR);
B(B_VARIN,,DataInput,8,1,10,3,);
B(B_VARIN,,ShiftTrigger,8,2,10,4,);
B(B_VARIN,,ResetTrigger,8,3,10,5,);
B(B_VAROUT,,Output,20,1,22,3,);
L(1,0,1,5);
        END_NETWORK_BODY
    END_NET_WORK
END_BODY

ST body

Output:=LSR(DataInput, ShiftTrigger, ResetTrigger);

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