06-11-2013 09:13 AM
A. As pjr1121 pointed out a relay will work. Solid state relays tend to be easier to drive from the digital outputs of the DAQ devices. Make sure you get one with a DC output. They are available, but you need to specify DC. The standard AC output solid state relays will not work on DC. (They might turn on but will not turn off). You can probably also use a transistor driven by a digital output on the DAQ.
B. Since you are writing a header to the file and then repeatedly writing data to the file during the scan, you must either specify the file at the beginning or else store all the data and write after the scan is done.
C. Use a <= 190? comparison and OR it with the stop button. Then the loop will stop at the end of the scan or when you press Stop. You should always use <=? rather than =? comparisons on non-integer numbers. Because of the way floating point numbers are represented in binary you may never get an exactly equal to 190 value. If the value differs by 1E-15, it will not be equal and the loop will not stop.
You should probably be writing a 1D array to the file (if you decide to continue writing on every iteration) with Transpose? set to False. You also need to initialize the spreadsheet to have as many columns as your data requires. How many samples do you have in the absorbance array on each iteration?
Lynn