Skip to main content

Example - Ladder Diagram

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.

Ladder Diagram Example


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.

Ladder Diagram Example


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.