AH500 Programming Manual Symbol: S 1 : Data source 1 Word/Double word S 2 : Data source 2 Word/Double word D : Operation result Word/Double word Explanation: 1. The logical operator OR takes the binary representations in S 1 and S 2 , and performs the logical inclusive OR operation on each pair of corresponding bits. The operation result is stored in D . 2. Only the instruction DOR can use the 32-bit counter. 3. The result in each position is 1 if the first bit is 1, the second bit is 1, or both bits are 1. Otherwise, the result is 0. Example 1:
When X0.0 is ON, the logical operator OR takes the data in the 16-bit device Y0 and the 16-bit device Y2, and performs the logical inclusive OR operation on each pair of corresponding bits. The operation result is stored in Y4.
b0 b15 Y0 Before the instruction is executed S1 S2 Y2 b0 b15 After the instruction is executed D Y4 6-183 API Instruction code 運算元 Function 0802 W D OR P S , S , D 1 2 Logical OR operation Device X Y M S T C HC D L SM SR E PR K 16# “$” DF S 1 S 2 D Pulse instruction 16-bit instruction (7 steps) 32-bit instruction (7 steps) AH AH AH 01 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 0 0 0 1 1 1 1 1 0 1 0 0 1 0 1 0 1 0 1 1 1 1 1 1 1 1 1 0 1 0 1