Solution
First, verify that the names of the switches in your code are strictly identical to the ones in NI MAX.
This behavior can also be caused by antivirus programs interfering with the NI driver communication. Disabling your antivirus can fix this behavior. Additionally, if your antivirus software allows you to whitelist programs, you can whitelist the NI-ModInst DLL that handles the communication between the hardware driver and the resources.
You can find these DLLs at:
- For 32-bit systems: C:\Program Files\IVI Foundation\IVI\Bin\niModInst.dll
- For 64-bit systems: C:\Program Files (x86)\IVI Foundation\IVI\Bin\niModInst.dll and C:\Program Files\IVI Foundation\IVI\Bin\niModInst_64.dll