BIT WISE AND/OR operation
Posted: Tue Oct 23, 2018 11:29 pm
Hi,
I would like to know how to execute BIT wise AND and OR operation.
Here is something i tried but didn't work:
My goal is to perform => X (BITWISE AND) 0xFF
My initial data was "BYTE' type so I tried converting the BYTE to INTEGER and then used " VAL " to convert it to SET. I thought with SET i would be to able to perform something like this,
I'm not sure if this is the right approach or is there any other way to perform BIT WISE AND/OR on BYTE type ? I would appreciate the help.
I would like to know how to execute BIT wise AND and OR operation.
Here is something i tried but didn't work:
My goal is to perform => X (BITWISE AND) 0xFF
My initial data was "BYTE' type so I tried converting the BYTE to INTEGER and then used " VAL " to convert it to SET. I thought with SET i would be to able to perform something like this,
Code: Select all
PROCEDURE w5500Send* (offset, blockselect, buffer, len : BYTE);
VAR highaddress, i : INTEGER;
lowaddress : BYTE;
x,y : SET;
W: Texts.Writer;
BEGIN
highaddress := LSL( offset, 8 ); (* offset is the BYTE type argument which is left shifted and stored in " highaddress " as INTEGER type *)
x := SYSTEM.VAL( SET, highaddress); (* Integer to SET *)[/color]
FOR i := 0 TO 7 DO
x{i} := x{i} * 1 ; (* This is where i thought i would do bit wise AND but it throws me an error " NOT A PROCEDURE TYPE" *)
END
highaddress := ORD(x) (* SET to integer , at this point i want to extract only 8 bit LSB and i dont know how to do it. *)
END w5500Send;