Instruction Parameters
Supported PLC Series
| PLC-AES | PLC-FB | PLC-ES |
|---|---|---|
| ✓ | ✓ | ✓ |
Supported Data Registers
| M | X | Y | K | L | F | T | C | S | Z | R | Q | D | @D | Constant | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| D | ✓ | – | ✓ | ✓ | ✓ | – | ✓ | ✓ | – | ✓ | ✓ | ✓ | ✓ | ✓ | – |
| n | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | – | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
Supported Flags
| Flag | Bit | Support |
|---|---|---|
| Error | F11.0 | ✓ |
| Zero | F11.1 | – |
| Carry | F11.2 | – |
Number of Steps
| Steps |
|---|
| 3 |
Operands
| Operand | Description |
|---|---|
| D | The first operand. Entries are only WORD data registers. This is the location of the data register to set the bit, n to ON. |
| n | The second operand. Entries are WORD data registers or constants. This is the bit number of the data register, D, to set to ON. The value range is 0 ~ 15. |
Notice
Error Flag (F11.0) Notice
The error flag, F11.0, will be ON for one scan when the address of the data register assigned by @D exceeds the range of the data register, D. The range of the data register, D, is dependent on the CPU type.
Instruction Behavior
The BSET and BSETP instructions behave as follows:
- The value, n, is value from 0 ~ 15.
- If the value, n, is greater than 15, the remainder from n ÷ 16 is the equivalent.
- Example: if n = 17, the remainder is 1. This is the same as S2 = 1.
- If the value, n, is greater than 15, the remainder from n ÷ 16 is the equivalent.
- Bits turned ON by either instruction.
- Bits can be turned OFF with the BRST or BRSTP
Ladder Diagram Examples
BSET

The BSET instruction sets a BOOL value in the WORD data register, D, from OFF (0) to ON (1). The BOOL value of the bit to set is defined by the value, n.

Currently, the value of the data register, D50, is 13,737, and the 11th bit is 0.

When the contact, M2.5, is powered ON (1), the 11th bit of the data register, D50, turns from 0 to 1.

As a result, the value of the data register, D50, is now 15,785, and the 11th bit is now 1.

BSETP

The BSETP one-shot instruction sets a BOOL value in the WORD data register, D, from OFF (0) to ON (1). The BOOL value of the bit to set is defined by the value, n. Every time this instruction executes, it energizes the output only once.

Currently, the value of the data register, D56, is -26,963, and the 6th bit is 0.

When the contact, M3.0, is powered ON (1), the 6th bit of the data register, D56, turns from 0 to 1.

As a result, the value of the data register, D56, is now -26,899, and the 6th bit is now 1.

