HP5508A replacement v1.2 - 3 axis support

Ok, next lets us add the ability to measure 3 channels of interferometer data at once.

In order to do that we will change the pin assignments slightly again, moving MEAS1 from pin 7/RB14 to pin 11/RB0.

Also, neither of those two pins are 5V tolerant, so what should have been done for version 1.1 already is a resistor divider to handle that. We will use 400/1000 Ohm resistors for this purpose.

Note that the resistor color codes do no reflect the actual values.

We are at (probably past) the point where the routing on the picture is useful, and a schematic is more appropriate. But for completeness, here is the picture with the additional hardware to complete the 3 axis interferometer:

The final pin and PIC hardware layout with respect to the counters, then is:

Input Counter TxCKR Bus Address Pin Signal Notes

 ------------------------------------------------------------------
   REF     Timer3    0b0001   0xbf800A10    0/RB5    RPB5
   MEAS1   Timer5    0b0010   0xbf800E10   11/RB0    RPB0    LED4
   MEAS2   Timer4    0b0100   0xbf800C10   13/RB2    RPB2    LED2
   MEAS3   Timer2    0b0001   0xbf800810   14/RB3    RPB3    LED1
The bus address is important because reading the timers is timing critical. So I am doing that with in-line assembly code.
The more general pin assignment is this:
   Usage      Pin (Arduino/PIC)       Notes
 ------------------------------------------------------------------
   REF        0/RB5   
   AM2303     1/RB7   
   BMP180     2/RB8  
   BMP180     3/RB9
   USB+       4/RB10
   USB-       5/RB11
              6/RB13
              7/RB14
              8/RB15
              9/RA0
             10/RA1 
   MEAS1     11/RB0                 LED4
             12/RB1                 LED3
   MEAS2     13/RB2                 LED2
   MEAS3     14/RB3                 LED1
   CLOCK     15/RA2
             16/RA3
             17/RB4
             18/RA4

That permits the DP32 board to measure 3 channels of interferometer data as well as two independent temperature measurements as well as humidity and air pressure.

Here is the SAR file with the firmware: https://sites.google.com/site/janbeck/Interferometer_3axis.sar

Sam Goldwasser maintains a separate firmware, using identical pinouts and communications protocol.

You can find that firmware (and a great Installation and Operation Manual) here:

http://repairfaq.cis.upenn.edu/Misc/uMD1/uMD1.htm

Eventually, the difference between the firmwares should just be performance. But for now, Sams firmware does phase estimation while mine does not yet do that.

And the GUI, which should work with any of the firmwares is available here:

https://github.com/janbbeck/InterferometerGUI

Here is the expanded message format for 3 axis data, including environmental data:

Standard (Single Axis) Data (8 values):

0: REF Frequency Count = REF frequency/610.35

1: MEAS Frequency Count 1 = MEAS 1 frequency/610.35

2: Displacement 1 ( in 1/2, 1/4, or 1/8 wavelength)

3: Velocity Count 1 = (Displacement 1 - Previous Displacement 1)/610.35

4: Phase 1 = Fractional offset between Displacement increments * 256 If Phase is not valid, then an error code is sent instead: 0x4000=no PORTB MEAS 1 0x2000=no PORTB 2nd REF 0x1000=no PORTB 1st REF 0x800=no Timer3/5 MEAS 1 0x400=no Timer3/5 2nd REF 0x200=no Timer3/5 1st REF

5: Sequence Number (Unique serial number for each sample)

6: LowSpeedCode (See below)

7: LowSpeedData (see below)

The following 8 values will also be sent when Multiple Axis Mode is active:

8: MEAS Frequency Count 2

9: Displacement 2

10: Velocity Count 2

11: Phase 2

12: MEAS Frequency Count 3

13: Displacement 3

14: Velocity Count 3

15: Phase 3 LowSpeedCode (specifies contents of LowSpeedData): 0-99: GUI Data/Control: 0: No Data 1: Laser Power 2: Signal Strength 3: Temperature 1 ( in percent, so 2345 is 23.45 degrees) 4: Temperature 2 ( in percent, so 2345 is 23.45 degrees) 5: Pressure ( in pascal ) 6: Humidity ( in tens of percent, so 234 is 23.4 percent humidity) 7: Data Source ID

20: Homodyne interferometer if non-zero

(Not all of these are currently implemented.) 100-199: Diagnostics 200-255: Reserved