Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

Edge HMI

SetBit

  • Last UpdatedAug 07, 2026
  • 1 minute read

SetBit sets (toggles) a specific bit in the value of a project tag.

Group

Sync / Async Exec

String Exp?

Windows Support

Windows Embedded Support

IoT View Support

Thin Client Support

Mobile Access Support

Arithmetic

Sync

No

Yes

Yes

Yes

Yes

Yes

Syntax

SetBit("tagName", numBitNumber)

tagName

The name of the project tag.

Note: If this parameter is enclosed in quotes, the string literal will be used. Otherwise, the value of the tag/expression will be used.

numBitNumber

The number or position (a number from 0 to 31) of the bit.

Return value

This function returns one of the following values:

Value

Description

0

Success (no error).

1

Invalid parameter.

2

Specified tag does not exist.

Notes

You can also reference the Bit property of a project tag in order to get/set a specific bit in the value of that tag. For more information, see Reference a tag property instead of a project tag.

Examples

Set the bit in the fifth position (the fourth bit) of MyInteger:

SetBit("MyInteger", 4)

If the old value of MyInteger was 14, the new value is 30. If the old value of MyInteger is 19, the new value is 3.

In This Topic