Eaton Logo

How can I shift 1 bit in a Byte to left in Codesys?

Please use SHL function block to shift bits in Codesys.

Example program.

VAR

v1: BYTE;

v2; BYTE;

END_VAR

 

v1 :=SHL(v2, 1)

 

in this example  v1 is 2 where v2 is 128.

v1 >> 00000011

v2>> 10000001