## Set Multiple Bits in One Instruction - SETA Omron PLC Programming

In the field of PLC programming, we must keep our self-update about the latest plc programming instructions. A plc program can be made in various ways for the same logic, but we always should try to make the plc program in the shortest way to achieve a good scan time and increase efficiency.

## SETA Omron PLC Programming Instruction

We all know about the popular SET instruction which is available in all the PLC used for SET of a particular bit. Think if we sometimes need to set more than one bit at a time, then this instruction can be beneficial. The instruction is available in all the Omron PLC for setting multiple bits at a time.

Instruction Syntax:- SETA D N1 N2

Where:- D is the beginning word, N1 is the beginning bit in D and N2 is the number of Bits.

For example, if we write that SETA d200 #5 #4, then when this instruction is executed than the bit no 5 to 9 are set in D100.

SETA(530) turns ON N2 bits, beginning from bit N1 of D, and continuing to the left (more-significant bits). All other bits are left unchanged. (No changes will be made if N2 is set to 0.)Bits turned ON by SETA(530) can be turned OFF by any other instructions, not just RSTA(531).

Recommended Article: PLC Programming For Counting Encoder Pulses

### RSTA Omron PLC Programming Instruction :-

Similarly to reset the multiple bits at a time we can use RSTA instruction.The syntax is same as for that of SETA. RSTA(531) turns OFF N2 bits, beginning from bit N1 of D, and continuing to the left (more-significant bits). All other bits are left unchanged. (No changes will be made if N2 is set to 0.)

Bits turned OFF by RSTA(531) can be turned ON by any other instructions, not just SETA(530).

Note:- SETA(530) can be used to turn ON bits in data areas that are normally accessed by words only, such as the DM areas.
Note:- RSTA(531) can be used to turn OFF bits in data areas that are normally accessed by words only, such as the DM areas.

Sample PLC Program Using SETA and RSTA.

Also, you can subscribe to Automation-Talk by Email to get all latest updates in PLC programming in your mailbox. If you have any doubts then you can write us in the comment section.

#### 1 comment:

1. Good instruction.