Hi Karan,
I looked more at your code, the “maximum voltage” control goes leads into the count terminal of the for loop. I don’t see how you are trying to connect the “minimum voltage” control in the same way. Also, it looks like data flow is not enforced in sections of your code which can result is the messages begin written to the device in an unknown order. I think you should go to ni.com/ask and create a service request so that you can speak with an engineer or visit ni.com/alliance and look for an alliance member who would be willing to talk with you about your needs and then develop your code.
Matt
Applications Engineer
National Instruments