Debug a VXI program
Perhaps the best way to debug a VXI program is using the NI Spy utility. Launch NI Spy and configure it to log your function calls. Now when you run your program, NI Spy logs all your calls to NI-VISA, the NI-VXI API, or NI-488.2. It highlights any functions that return errors, and you can check the parameters that get passed into any of these functions.
If a device is not behaving the way you would expect it to, you can debug many problems using VISAIC or VIC. You can use these utilities to interact with your devices without writing a program. This way you can make sure your techniques for communicating with a device are sound without worrying about your application being written correctly. Once you can establish communication, you can use the same calls you made in VISAIC or VIC in your program.