       1.50 V: brisker       94
       3.63 V: max          227 counts     
       255 counts = 4.08 V      
-      */
-   DAC_Write(0, counts);
-}
+     */
+    DAC_Write(0, counts);
+}
+
 /*---------------------------------------------------------------------------------------*/
 /* DAC_Write applies value to address, producing an analog voltage.
-// address: 0 for chan A; 1 for chan B; 2 for chan C; 3 for chan D
-// value: digital value converted to analog voltage
-// Output goes to mcp 4802 Digital-Analog Converter Chip via SPI
-// There is no input back from the chip.
-*/
-void DAC_Write(int address, int value)
+   address: 0 for chan A; 1 for chan B; 2 for chan C; 3 for chan D
+   value: digital value converted to analog voltage
+   Output goes to mcp 4802 Digital-Analog Converter Chip via SPI
+   There is no input back from the chip.
+ */
 
 /*
 REGISTER 5-3: WRITE COMMAND REGISTER FOR MCP4802 (8-BIT DAC)

         VOUT pin is connected to 500 k (typical)
bit 11-0 D11:D0: DAC Input Data bits. Bit x is ignored.


With 4.95 V on Vcc, observed output for 255 is 4.08V.
This is as documented; with gain of 2, maximum output is 2 * Vref

*/

{
  int byte1 = ((value & 0xF0)>>4) | 0x10; // acitve mode, bits D7-D4
  int byte2 = (value & 0x0F)<<4;           // D3-D0
  if (address < 2)
  {
      // take the SS pin low to select the chip:
      digitalWrite(SelectAB,LOW);
      if (address >= 0)
      { 
        if (address == 1)
          byte1 |= 0x80;  // second channnel
        SPI.transfer(byte1);
        SPI.transfer(byte2);
       }
      // take the SS pin high to de-select the chip:
      digitalWrite(SelectAB,HIGH);
  }
  else
  {
      // take the SS pin low to select the chip:
      digitalWrite(SelectCD,LOW);
      if (address <= 3)
      {
        if (address == 3)
          byte1 |= 0x80;  // second channnel
        SPI.transfer(byte1);
        SPI.transfer(byte2);
      }
       // take the SS pin high to de-select the chip:
      digitalWrite(SelectCD,HIGH);
  }
}
/*---------------------------------------------------------------------------------------*/ 



    Serial.begin(115200); // monitor
    Serial.println("Start initialization");
    Serial3.begin(115200); // C3 to C2;  C2 to C6
    /* A typical message is 20 ASCII characters of 20 bits each
	   (2 8-bit bytes / character + start bit + stop bit)
	   At 115,200 bits/s, a typical message takes 3.5 ms.
	   Thus there is about a 10 ms delay (best case) in passing 
	   information from C6 to C2.
     */

    // SPI: set the slaveSelectPin as an output:
    pinMode (SelectAB, OUTPUT);
    pinMode (SelectCD, OUTPUT);
