UP | HOME

Excerpt From Lab Notebook

What follows is an excerpt from my lab notebook. At the time I was working on an hybrid analog computer that used a microcontroller & DAC to provide the fixed analog voltages traditionally provided by "parameter" potentiometers in older systems. The DAC was controlled by an SPI interface connected to the microcontroller. The microcontroller would sometimes come up faster than the DAC and start sending SPI signals to the DAC before the DAC was fully initialized – which burned up the DAC. I lost two DACs before I realized what was happening.

Having the mrSCPI code in my notebook like this allows me to reproduce my bench hardware configuration by simply having org-mode evaluate the code. And I can do that right in my editor while I'm reading my notes.

A lot of people talk about how important Reproducibility is to the scientific process, and that it is worth the extra work. The example below illustrates that reproducibility isn't necessarily a burden at all. It can, in fact, be a productivity gain in the long run.




.. BEGIN Excerpt .. BEGIN Excerpt .. BEGIN Excerpt .. BEGIN Excerpt .. BEGIN Excerpt ..




1. Power Sequenceing

The DAC will be bricked if a voltage over 3V is applied to an SPI intput before the DAC is powered up and initializes. The initialization takes about 30ms. For this reason it is critical that I power up the DAC before I power up the microcontorler board:

:url @hmc8043
:result_type nil
:delay_after_complete 200
:cmd :OUTPut:MASTer:STATe OFF
# Set 9V & 08mA on Ch1 & Ch2.  Set 5V @ 60mA on Ch1.
:cmd :INSTrument:NSELect 1; :SOURce:VOLTage:LEVel:IMMediate:AMPLitude 9.0; :SOURce:CURRent:LEVel:IMMediate:AMPLitude 80.0e-3;
:cmd :INSTrument:NSELect 2; :SOURce:VOLTage:LEVel:IMMediate:AMPLitude 9.0; :SOURce:CURRent:LEVel:IMMediate:AMPLitude 80.0e-3;
:cmd :INSTrument:NSELect 3; :SOURce:VOLTage:LEVel:IMMediate:AMPLitude 5.0; :SOURce:CURRent:LEVel:IMMediate:AMPLitude 60.0e-3;
# Set Ch1 & Ch2 to start first, and then Ch3 90ms later.
:cmd :SEQuence:STATe OFF
:cmd :INSTrument:NSELect 1; :SEQuence:CHANnel:STATe ON; :SEQuence:DELay 10.0;  :SEQuence:TRIGgered OFF
:cmd :INSTrument:NSELect 2; :SEQuence:CHANnel:STATe ON; :SEQuence:DELay 10.0;  :SEQuence:TRIGgered OFF
:cmd :INSTrument:NSELect 3; :SEQuence:CHANnel:STATe ON; :SEQuence:DELay 100.0; :SEQuence:TRIGgered OFF
:cmd :SEQuence:STATe ON
# Activate all the channels
:cmd :INSTrument:NSELect 1; :OUTPut:CHANnel:STATe ON
:cmd :INSTrument:NSELect 2; :OUTPut:CHANnel:STATe ON
:cmd :INSTrument:NSELect 3; :OUTPut:CHANnel:STATe ON
# At this point, the master enable needs to be pressed.




.. END Excerpt .. END Excerpt .. END Excerpt .. END Excerpt .. END Excerpt ..