⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 daq53.cpp

📁 matlab daq sampling source code
💻 CPP
📖 第 1 页 / 共 5 页
字号:
  if (nlhs > 1 ||
      nrhs != 1+1)
    mexErrMsgTxt("Wrong number of arguments to function AI_Clear");
  short _arg_slot;
  short _arg_retval;
  if (_n_dims(prhs[1]) > 0)
    mexErrMsgTxt("Error in dimension of argument slot");
  if (!_get_numeric(prhs[1], &_arg_slot))
    mexErrMsgTxt("Expecting numeric scalar for argument slot");

  plhs[0] = mxCreateDoubleMatrix(1, 1, mxREAL);
    _arg_retval = (short)
      AI_Clear(_arg_slot);
  *mxGetPr(plhs[0]) = (double)_arg_retval;
}

void _wrap_AI_Configure(int nlhs, mxArray **plhs, int nrhs, const mxArray **prhs)
{
  if (nlhs > 1 ||
      nrhs != 6+1)
    mexErrMsgTxt("Wrong number of arguments to function AI_Configure");
  short _arg_slot;
  short _arg_chan;
  short _arg_inputMode;
  short _arg_inputRange;
  short _arg_polarity;
  short _arg_driveAIS;
  short _arg_retval;
  if (_n_dims(prhs[1]) > 0)
    mexErrMsgTxt("Error in dimension of argument slot");
  if (!_get_numeric(prhs[1], &_arg_slot))
    mexErrMsgTxt("Expecting numeric scalar for argument slot");

  if (_n_dims(prhs[2]) > 0)
    mexErrMsgTxt("Error in dimension of argument chan");
  if (!_get_numeric(prhs[2], &_arg_chan))
    mexErrMsgTxt("Expecting numeric scalar for argument chan");

  if (_n_dims(prhs[3]) > 0)
    mexErrMsgTxt("Error in dimension of argument inputMode");
  if (!_get_numeric(prhs[3], &_arg_inputMode))
    mexErrMsgTxt("Expecting numeric scalar for argument inputMode");

  if (_n_dims(prhs[4]) > 0)
    mexErrMsgTxt("Error in dimension of argument inputRange");
  if (!_get_numeric(prhs[4], &_arg_inputRange))
    mexErrMsgTxt("Expecting numeric scalar for argument inputRange");

  if (_n_dims(prhs[5]) > 0)
    mexErrMsgTxt("Error in dimension of argument polarity");
  if (!_get_numeric(prhs[5], &_arg_polarity))
    mexErrMsgTxt("Expecting numeric scalar for argument polarity");

  if (_n_dims(prhs[6]) > 0)
    mexErrMsgTxt("Error in dimension of argument driveAIS");
  if (!_get_numeric(prhs[6], &_arg_driveAIS))
    mexErrMsgTxt("Expecting numeric scalar for argument driveAIS");

  plhs[0] = mxCreateDoubleMatrix(1, 1, mxREAL);
    _arg_retval = (short)
      AI_Configure(_arg_slot, _arg_chan, _arg_inputMode, _arg_inputRange, _arg_polarity, _arg_driveAIS);
  *mxGetPr(plhs[0]) = (double)_arg_retval;
}

void _wrap_AI_Mux_Config(int nlhs, mxArray **plhs, int nrhs, const mxArray **prhs)
{
  if (nlhs > 1 ||
      nrhs != 2+1)
    mexErrMsgTxt("Wrong number of arguments to function AI_Mux_Config");
  short _arg_slot;
  short _arg_numMuxBrds;
  short _arg_retval;
  if (_n_dims(prhs[1]) > 0)
    mexErrMsgTxt("Error in dimension of argument slot");
  if (!_get_numeric(prhs[1], &_arg_slot))
    mexErrMsgTxt("Expecting numeric scalar for argument slot");

  if (_n_dims(prhs[2]) > 0)
    mexErrMsgTxt("Error in dimension of argument numMuxBrds");
  if (!_get_numeric(prhs[2], &_arg_numMuxBrds))
    mexErrMsgTxt("Expecting numeric scalar for argument numMuxBrds");

  plhs[0] = mxCreateDoubleMatrix(1, 1, mxREAL);
    _arg_retval = (short)
      AI_Mux_Config(_arg_slot, _arg_numMuxBrds);
  *mxGetPr(plhs[0]) = (double)_arg_retval;
}

void _wrap_AI_Read(int nlhs, mxArray **plhs, int nrhs, const mxArray **prhs)
{
  if (nlhs != 2 ||
      nrhs != 3+1)
    mexErrMsgTxt("Wrong number of arguments to function AI_Read");
  short _arg_slot;
  short _arg_chan;
  short _arg_gain;
  short _arg_value;
  short _arg_retval;
  if (_n_dims(prhs[1]) > 0)
    mexErrMsgTxt("Error in dimension of argument slot");
  if (!_get_numeric(prhs[1], &_arg_slot))
    mexErrMsgTxt("Expecting numeric scalar for argument slot");

  if (_n_dims(prhs[2]) > 0)
    mexErrMsgTxt("Error in dimension of argument chan");
  if (!_get_numeric(prhs[2], &_arg_chan))
    mexErrMsgTxt("Expecting numeric scalar for argument chan");

  if (_n_dims(prhs[3]) > 0)
    mexErrMsgTxt("Error in dimension of argument gain");
  if (!_get_numeric(prhs[3], &_arg_gain))
    mexErrMsgTxt("Expecting numeric scalar for argument gain");

  plhs[0] = mxCreateDoubleMatrix(1, 1, mxREAL);
  plhs[1] = mxCreateDoubleMatrix(1, 1, mxREAL);
    _arg_retval = (short)
      AI_Read(_arg_slot, _arg_chan, _arg_gain, &_arg_value);
  *mxGetPr(plhs[0]) = (double)_arg_retval;
  *mxGetPr(plhs[1]) = (double)_arg_value;
}

void _wrap_AI_Scale(int nlhs, mxArray **plhs, int nrhs, const mxArray **prhs)
{
  if (nlhs != 2 ||
      nrhs != 3+1)
    mexErrMsgTxt("Wrong number of arguments to function AI_Scale");
  short _arg_slot;
  short _arg_gain;
  short _arg_value;
  double _arg_voltage;
  short _arg_retval;
  if (_n_dims(prhs[1]) > 0)
    mexErrMsgTxt("Error in dimension of argument slot");
  if (!_get_numeric(prhs[1], &_arg_slot))
    mexErrMsgTxt("Expecting numeric scalar for argument slot");

  if (_n_dims(prhs[2]) > 0)
    mexErrMsgTxt("Error in dimension of argument gain");
  if (!_get_numeric(prhs[2], &_arg_gain))
    mexErrMsgTxt("Expecting numeric scalar for argument gain");

  if (_n_dims(prhs[3]) > 0)
    mexErrMsgTxt("Error in dimension of argument value");
  if (!_get_numeric(prhs[3], &_arg_value))
    mexErrMsgTxt("Expecting numeric scalar for argument value");

  plhs[0] = mxCreateDoubleMatrix(1, 1, mxREAL);
  plhs[1] = mxCreateDoubleMatrix(1, 1, mxREAL);
    _arg_retval = (short)
      AI_Scale(_arg_slot, _arg_gain, _arg_value, &_arg_voltage);
  *mxGetPr(plhs[0]) = (double)_arg_retval;
  *mxGetPr(plhs[1]) = (double)_arg_voltage;
}

void _wrap_AI_Setup(int nlhs, mxArray **plhs, int nrhs, const mxArray **prhs)
{
  if (nlhs > 1 ||
      nrhs != 3+1)
    mexErrMsgTxt("Wrong number of arguments to function AI_Setup");
  short _arg_slot;
  short _arg_chan;
  short _arg_gain;
  short _arg_retval;
  if (_n_dims(prhs[1]) > 0)
    mexErrMsgTxt("Error in dimension of argument slot");
  if (!_get_numeric(prhs[1], &_arg_slot))
    mexErrMsgTxt("Expecting numeric scalar for argument slot");

  if (_n_dims(prhs[2]) > 0)
    mexErrMsgTxt("Error in dimension of argument chan");
  if (!_get_numeric(prhs[2], &_arg_chan))
    mexErrMsgTxt("Expecting numeric scalar for argument chan");

  if (_n_dims(prhs[3]) > 0)
    mexErrMsgTxt("Error in dimension of argument gain");
  if (!_get_numeric(prhs[3], &_arg_gain))
    mexErrMsgTxt("Expecting numeric scalar for argument gain");

  plhs[0] = mxCreateDoubleMatrix(1, 1, mxREAL);
    _arg_retval = (short)
      AI_Setup(_arg_slot, _arg_chan, _arg_gain);
  *mxGetPr(plhs[0]) = (double)_arg_retval;
}

void _wrap_AI_VRead(int nlhs, mxArray **plhs, int nrhs, const mxArray **prhs)
{
  if (nlhs != 2 ||
      nrhs != 3+1)
    mexErrMsgTxt("Wrong number of arguments to function AI_VRead");
  int _d[4] = { 1,1,1,1 };
  int _vec_n = 0;
  int _vidx;
  int _vec_sz;
  short *_arg_slot;
  short *_arg_chan;
  short *_arg_gain;
  double *_arg_volts;
  short *_arg_retval;
  int _vecstride_slot = 1;
  int _vecstride_chan = 1;
  int _vecstride_gain = 1;
  if (!_check_input_vectorize(prhs[1], &_vec_n, _d, 0, &_vecstride_slot))
    mexErrMsgTxt("Error in dimension of argument slot");
  if (mxIsInt16(prhs[1]) || mxIsUint16(prhs[1]))
    _arg_slot = (short *)mxGetData(prhs[1]);
  else
  {
    _arg_slot = MEM_ALLOC(short *, _arraylen(prhs[1]), sizeof (short));
    if (!_get_numeric(prhs[1], _arg_slot))
      mexErrMsgTxt("Expecting numeric matrix for argument slot");
  }

  if (!_check_input_vectorize(prhs[2], &_vec_n, _d, 0, &_vecstride_chan))
    mexErrMsgTxt("Error in dimension of argument chan");
  if (mxIsInt16(prhs[2]) || mxIsUint16(prhs[2]))
    _arg_chan = (short *)mxGetData(prhs[2]);
  else
  {
    _arg_chan = MEM_ALLOC(short *, _arraylen(prhs[2]), sizeof (short));
    if (!_get_numeric(prhs[2], _arg_chan))
      mexErrMsgTxt("Expecting numeric matrix for argument chan");
  }

  if (!_check_input_vectorize(prhs[3], &_vec_n, _d, 0, &_vecstride_gain))
    mexErrMsgTxt("Error in dimension of argument gain");
  if (mxIsInt16(prhs[3]) || mxIsUint16(prhs[3]))
    _arg_gain = (short *)mxGetData(prhs[3]);
  else
  {
    _arg_gain = MEM_ALLOC(short *, _arraylen(prhs[3]), sizeof (short));
    if (!_get_numeric(prhs[3], _arg_gain))
      mexErrMsgTxt("Expecting numeric matrix for argument gain");
  }

  {
    int _ds[] = { _d[0] , _d[1] , _d[2] , _d[3]  };
    plhs[0] = mxCreateNumericArray(max((0 + _vec_n), 2), _ds, mxDOUBLE_CLASS, mxREAL);
    _arg_retval = MEM_ALLOC(short *, _arraylen(plhs[0]), sizeof (short));
  }
  {
    int _ds[] = { _d[0] , _d[1] , _d[2] , _d[3]  };
    plhs[1] = mxCreateNumericArray(max((0 + _vec_n), 2), _ds, mxDOUBLE_CLASS, mxREAL);
    _arg_volts = mxGetPr(plhs[1]);
  }
  _vec_sz = _d[0]*_d[1]*_d[2]*_d[3];
  for (_vidx = 0; _vidx < _vec_sz; ++_vidx) {
    _arg_retval[_vidx] = (short)
      AI_VRead(_arg_slot[_vecstride_slot*_vidx], _arg_chan[_vecstride_chan*_vidx], _arg_gain[_vecstride_gain*_vidx], &_arg_volts[_vidx]);
  }
  {
    int _fidx;
    double *d_ptr = mxGetPr(plhs[0]);
    for (_fidx = 0; _fidx < _arraylen(plhs[0]); ++_fidx)
      *d_ptr++ = (double)*_arg_retval++;
  }
}

void _wrap_AI_VScale(int nlhs, mxArray **plhs, int nrhs, const mxArray **prhs)
{
  if (nlhs != 2 ||
      nrhs != 6+1)
    mexErrMsgTxt("Wrong number of arguments to function AI_VScale");
  short _arg_slot;
  short _arg_chan;
  short _arg_gain;
  double _arg_gainAdjust;
  double _arg_offset;
  short _arg_reading;
  double _arg_voltage;
  short _arg_retval;
  if (_n_dims(prhs[1]) > 0)
    mexErrMsgTxt("Error in dimension of argument slot");
  if (!_get_numeric(prhs[1], &_arg_slot))
    mexErrMsgTxt("Expecting numeric scalar for argument slot");

  if (_n_dims(prhs[2]) > 0)
    mexErrMsgTxt("Error in dimension of argument chan");
  if (!_get_numeric(prhs[2], &_arg_chan))
    mexErrMsgTxt("Expecting numeric scalar for argument chan");

  if (_n_dims(prhs[3]) > 0)
    mexErrMsgTxt("Error in dimension of argument gain");
  if (!_get_numeric(prhs[3], &_arg_gain))
    mexErrMsgTxt("Expecting numeric scalar for argument gain");

  if (_n_dims(prhs[4]) > 0)
    mexErrMsgTxt("Error in dimension of argument gainAdjust");
  if (!_get_numeric(prhs[4], &_arg_gainAdjust))
    mexErrMsgTxt("Expecting numeric scalar for argument gainAdjust");

  if (_n_dims(prhs[5]) > 0)
    mexErrMsgTxt("Error in dimension of argument offset");
  if (!_get_numeric(prhs[5], &_arg_offset))
    mexErrMsgTxt("Expecting numeric scalar for argument offset");

  if (_n_dims(prhs[6]) > 0)
    mexErrMsgTxt("Error in dimension of argument reading");
  if (!_get_numeric(prhs[6], &_arg_reading))
    mexErrMsgTxt("Expecting numeric scalar for argument reading");

  plhs[0] = mxCreateDoubleMatrix(1, 1, mxREAL);
  plhs[1] = mxCreateDoubleMatrix(1, 1, mxREAL);
    _arg_retval = (short)
      AI_VScale(_arg_slot, _arg_chan, _arg_gain, _arg_gainAdjust, _arg_offset, _arg_reading, &_arg_voltage);
  *mxGetPr(plhs[0]) = (double)_arg_retval;
  *mxGetPr(plhs[1]) = (double)_arg_voltage;
}

void _wrap_AO_Calibrate(int nlhs, mxArray **plhs, int nrhs, const mxArray **prhs)
{
  if (nlhs > 1 ||
      nrhs != 3+1)
    mexErrMsgTxt("Wrong number of arguments to function AO_Calibrate");
  short _arg_board;
  short _arg_operation;
  short _arg_EEPROMloc;
  short _arg_retval;
  if (_n_dims(prhs[1]) > 0)
    mexErrMsgTxt("Error in dimension of argument board");
  if (!_get_numeric(prhs[1], &_arg_board))
    mexErrMsgTxt("Expecting numeric scalar for argument board");

  if (_n_dims(prhs[2]) > 0)
    mexErrMsgTxt("Error in dimension of argument operation");
  if (!_get_numeric(prhs[2], &_arg_operation))
    mexErrMsgTxt("Expecting numeric scalar for argument operation");

  if (_n_dims(prhs[3]) > 0)
    mexErrMsgTxt("Error in dimension of argument EEPROMloc");
  if (!_get_numeric(prhs[3], &_arg_EEPROMloc))
    mexErrMsgTxt("Expecting numeric scalar for argument EEPROMloc");

  plhs[0] = mxCreateDoubleMatrix(1, 1, mxREAL);
    _arg_retval = (short)
      AO_Calibrate(_arg_board, _arg_operation, _arg_EEPROMloc);
  *mxGetPr(plhs[0]) = (double)_arg_retval;
}

void _wrap_AO_Change_Parameter(int nlhs, mxArray **plhs, int nrhs, const mxArray **prhs)
{
  if (nlhs > 1 ||
      nrhs != 4+1)
    mexErrMsgTxt("Wrong number of arguments to function AO_Change_Parameter");
  short _arg_slot;
  short _arg_channel;
  unsigned long _arg_paramID;
  unsigned long _arg_paramValue;
  short _arg_retval;
  if (_n_dims(prhs[1]) > 0)
    mexErrMsgTxt("Error in dimension of argument slot");
  if (!_get_numeric(prhs[1], &_arg_slot))
    mexErrMsgTxt("Expecting numeric scalar for argument slot");

  if (_n_dims(prhs[2]) > 0)
    mexErrMsgTxt("Error in dimension of argument channel");
  if (!_get_numeric(prhs[2], &_arg_channel))
    mexErrMsgTxt("Expecting numeric scalar for argument channel");

  if (_n_dims(prhs[3]) > 0)
    mexErrMsgTxt("Error in dimension of argument paramID");
  if (!_get_numeric(prhs[3], &_arg_paramID))
    mexErrMsgTxt("Expecting numeric scalar for argument paramID");

  if (_n_dims(prhs[4]) > 0)
    mexErrMsgTxt("Error in dimension of argument paramValue");

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -