This vi is agood example of setting a bit mask, specific state and bit switching.
Regards,Dan King
Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.