Exemplo n.º 1
0
 /** Starts the component. Detects ADC and will report error if this fails */
 public void start() {
   port = CIMPortManager.getInstance().getConnection(ADC_CIM_ID);
   if (port != null) {
     super.start();
     AstericsErrorHandling.instance.reportInfo(this, "AnalogOutInstance started");
   } else {
     AstericsErrorHandling.instance.reportError(this, "Could not find DAC CIM");
   }
 }
Exemplo n.º 2
0
  /**
   * Clips the input to the available range and transfers it to the CIM
   *
   * @param value the voltage value (0 to 240 representing 100mV steps)
   * @param index the index of the output to set the value on
   */
  public void processInput(int value, int index) {
    int val = value;
    if (val > 240) val = 240;
    else if (val < 0) val = 0;

    dacValues[index] = (byte) val;

    if (port != null) {
      CIMPortManager.getInstance()
          .sendPacket(
              port,
              dacValues,
              ADC_FEATURE_DAC_OUTPUT_VALUE,
              CIMProtocolPacket.COMMAND_REQUEST_WRITE_FEATURE,
              false);
    }
  }