I mentioned in the Vacuum System project that LabVIEW has quite a learning curve, since then I am working a job where I have used it a couple times to build test fixtures and even taken all of the official LabVIEW courses. And I still have issues wrapping my head around it. A lot of times it is throwing things at the screen and see if it works, lol.
Anyway with the basic program in hand I read through it and just recreated the same program in labview, i managed to find someone that already had a library for LV that handled the 8 bit to BCD conversion I needed so that greatly simplified things. While I was waiting for the corrected boards to show up I went ahead and wrote sections of code to replicate the front panel buttons on the wavelength control and also made a "Go To" state machine loop that allowed me to type in a wavelength and it would go to it. It determines if the Go To wavelength is below or above the current wavelength and then determined how fast it should approach that point based on how far away it was. The spectrometer always approaches the set point from below, so say we set it to 400nm and we are at 500nm, the drive will drive it at high speed to 397nm, stop and then creep slowly to 400nm and stop. If the spectrometer is at 300nm it drives fast to 398nm and then creeps slowly to 400nm and stops. If it is at 397nm it just creeps slowly to the set point.
Once the new adapter boards showed up I gave it a try and both the spectrometer control and the radiometer readout worked with only a bug each. The state machine did not fare so well, I goofed on some of the comparisons and had to fix that but it was not too bad.
Next I tackled saving files. Oh boy this was more difficult that it should have been, I probably spent 6 hours trying to get it to save files all the while heading down a dead end path, it just kept dumping data into files even of the machine was not scanning. It all came down to using a value(signaling) tag to trigger the save but it did not operate like I thought. I spent hours thinking I had a signal noise issue and it was just my lack of understanding how it worked. I found out I just needed to have the save inside a state machine, so that means I need to do the next part, the actual scan control.
For this part I wanted to set the beginning and end wavelengths as well as the interval at which it scans. Also open the shutter and close it at the end of the scan. This took a couple evenings of writing and debugging and tweeting to get it to work like I like, it reuses a lot of the code from the Go To program and then expands on it.
Works like this:
Goes to the start wavelength as before
opens the shutter,
waits a programmable dwell period
saves the radiometer value
looks to see how far the next increment is to determine how fast it should move
repeat stop, dwell, save, and increment until it hits the end point set.
The UI is a mess and I am still tweaking things but it works pretty well now.
Here is a link to data from a scan, the little blip at 600 nm is from the order sorting filter kicking in.