I write the wavelength calibration coefficients to spectrometer's EEPROM using setCalibrationCoefficientsIntoEEProm as in the following script:
% define wavelength calibration coefficients values
calibCoeffWl = [178.70158, 0.379557, -1.442072e-05, -1.855855e-09];% identify spectrometer index and channel index
spIndex = 0;chIndex = 0;% connect to spectrometer
sp = icdevice('OceanOptics_OmniDriver.mdd');connect(sp);% initialize coefficients data
coeff = invoke(sp.Coefficients, 'Coefficients');% update coefficients data with wavelength calibration coefficients
invoke(coeff, 'setWlCoefficients', calibCoeffWl)% write coefficients data to EEPROM (apply wavelength coefficients only)
invoke(sp, 'insertKey', 'Mat429sky');invoke(sp, 'setCalibrationCoefficientsIntoEEProm', spIndex, chIndex, 1, 0, 0);invoke(sp, 'removeKey');% disconnect
disconnect(sp);
Next time I connect to the spectrometer I receive the following warning/error and the coefficients read back from the spectrometer's EEPROM have incorrect values.
% identify spectrometer index and channel indexspIndex = 0;chIndex = 0;% connect to spectrometersp = icdevice('OceanOptics_OmniDriver.mdd');connect(sp);% read coefficients data from EEPROM
coeff = invoke(sp, 'getCalibrationCoefficientsFromEEProm', spIndex, chIndex);% obtain array with wavelength calibration coefficients values
calibCoeffWl = invoke(coeff, 'getWlCoefficients');% display wavelength calibration coefficients values
sprintf('%.7e\n', calibCoeffWl)% disconnectdisconnect(sp);
Mar 28, 2014 8:25:33 PM com.oceanoptics.omnidriver.spectrometer.SpectrometerChannel getCoefficientsFromSpectrometer
WARNUNG: ERROR: For input string: "1,787016E002"
Mar 28, 2014 8:25:33 PM com.oceanoptics.omnidriver.spectrometer.SpectrometerChannel getCoefficientsFromSpectrometer
WARNUNG: ERROR: cannot read wavelength coefficients from spectrometer. Setting to pixel indices.
Mar 28, 2014 8:25:33 PM com.oceanoptics.omnidriver.spectrometer.SpectrometerChannel getCoefficientsFromSpectrometer
WARNUNG: Intercept was [1,787016E002]
…
ans = 0.0000000e+00 1.0000000e+00 0.0000000e+00 0.0000000e+00
Best Answer