예제 #1
0
  private void setVoltageOnDac(double voltage, boolean outputGain, boolean shutdown, short command)
      throws IOException {
    command = BitMagic.setBit(command, 14, 0);
    if (outputGain) {
      command = BitMagic.setBit(command, 13, 0);
    }

    if (shutdown) {
      command = BitMagic.setBit(command, 12, 0);
    } else {
      command = BitMagic.setBit(command, 12, 1);
    }
    command |= ((0xFFFFFFFF & ((int) (255 * voltage))) << 4);
    byte[] bytes = new byte[2];
    bytes[0] = (byte) ((0xFF00 & command) >> 8);
    bytes[1] = (byte) ((0X00FF & command));
    getBusConnection().writeBytes(bytes);
  }
예제 #2
0
 public void shutdownDacB() throws IOException {
   short command = 0x00;
   command = BitMagic.setBit(command, 15, 1);
   setVoltageOnDac(0.0, false, true, command);
 }
예제 #3
0
 public void setVoltageOnDacB(double voltage, boolean outputGain) throws IOException {
   short command = 0x00;
   command = BitMagic.setBit(command, 15, 1);
   setVoltageOnDac(voltage, outputGain, false, command);
 }