One talks to the stamp over a serial line. One sends 8 ascii characters and receives back 8 ascii characters. Only the low order 4 bits in each byte is looked at in the stamp. This allows me to program in Basic without Basic noticing control characters as they go by. So I only use ascii:
0,1,2,3,4,5,6,7,8,9,:,;,<,=,>,?
which corresponds to hex 30-3F.
The first and last characters sent are a version and sub version number. The PC code is supposed to check that it gets back the same version and sub version that it sent out. The Stamp will check this, and do nothing if they do not match the values stored in its prom. The PC has to notice that they do not match and realize that nothing was done.
The six middle characters are:
INST0 INST1 DATA0 DATA1 DATA2 DATA3
In general, INST0 is the major class of instruction some of these are:
STEPPER LOADADAC ADC PULSE RADRIVE SENSE MASERVO TEST
Sub Instructions:
Major uses for stepping motors are the Declination drive and the focus motors. The stamp works full time stepping the motors. Possibly several things could be done at once since there are timed waits between steps
To save power, the stepping motors are turned off when not stepping. When you turn them back on again, their drive register has to be loaded with the value it contained when you turned it off, else it will move. So it is necessary to keep track of the contents of the drive register - or make sure you do not change it when doing something else.
I will probably keep track in the PC to make the stamp code easier, so I will down load the register bits along with the number of steps in the data portion of the command string.
DATA3 (LO) and DATA2 (HO) contain the 8 bit value to load. DATA1 contains the DAC gain and channel number. The sub instruction INST1 determines which block of 8 DACs is to have a channel loaded. There are 16 DACs scales +/- 10 volts, at about 100 mv per bit.
DATA0 and DATA1 determine which of 32 channels is selected. A 16 bit signed integer is returned in DATA0-DATA3. These read only things to monitor the operation of the system. There is a separate ADC for each camera head which only dumps it's data to the memory card.
The ADC reads all the power supply voltages. A first thing on my list is to check all the power supplies on turn on and at frequent intervals thereafter. A good policy is to keep a table of old values of power supply reading and to compute a sigma (RMS) value for each supply. The way power supplies usually get sick is to have there ripple increase. This will detect that problem, usually before data is spoiled.
The ADC reads all the clock levels. The CCD won't work unless its clock levels are correct. Fortunately, bad clock levels don't kill it else I would have more dead CCDs than I have now. It would also make for a very complicated turn on problem. Again I would check these from time to time.
The ADC reads the TEC currents. A good check on the TEC servo.
The ADC reads a bunch of temperatures. The CCD temperatures for sure and othere things like cooling water ambient, the VCO, etc..
It even reads ground. Sigh! I always measure zero. A good check on everything else.
DATA0 and DATA1 determine which of 24 possible internal pulses is generated. Of most interest is "Start Scan", which starts the read out of the CCD. Also of interest to programmers is "Block Done". This can be used to force an interrupt simulating completion of a scan for test purposes. One has to know about the pulses in detail to do anything special.
The RA drive is driven from a count down from a voltage controlled oscillator. The VCO has a control pot to get position it in a good range, and can be trimmed by one of the DAC channels. There is a thermometer located near the VCO so that temperature compensation is possible. An 8 to 1 selection allows a count down selection over a range of 128 to 1 - seven selections. The eighth line can be pulsed from a PULSE line - one step at a time.
A register bit controls the direction. A second register bit turns on the drive power. The motor is half stepped to get greater resolution.
I figure I will provide the following commands to the RA drive:
Set Speed Trim Speed (done with a DAC load command) Direction = E Direction = W Go Home at Full Speed n Steps E n Steps W Drive On Drive Off
The status of 14 IR interrupters is returned in DATA0-DATA3
The Model Airplane servos are used for the shutters and wherever else one wants an absolute position. There are 8 channels of MAServo. DATA0 and DATA1 contain the register path to the servo channel, DATA2 and DATA3 contain the position. MA servos work by sensing a pulse width. The stamp code takes the position command and generates a pulse width between 1 and 2 milliseconds from it. The MA servo positions itself to match the pulse width. This takes a few hundred milliseconds. The stamp code repeats the pulse width 50 times over 1 second. This could be made faster - 200-300 milliseconds should do it.
There will be test functions.