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

📄 daq53.cpp

📁 matlab daq sampling source code
💻 CPP
📖 第 1 页 / 共 5 页
字号:
  if (!_get_numeric(prhs[4], &_arg_paramValue))
    mexErrMsgTxt("Expecting numeric scalar for argument paramValue");

  plhs[0] = mxCreateDoubleMatrix(1, 1, mxREAL);
    _arg_retval = (short)
      AO_Change_Parameter(_arg_slot, _arg_channel, _arg_paramID, _arg_paramValue);
  *mxGetPr(plhs[0]) = (double)_arg_retval;
}

void _wrap_AO_Configure(int nlhs, mxArray **plhs, int nrhs, const mxArray **prhs)
{
  if (nlhs > 1 ||
      nrhs != 6+1)
    mexErrMsgTxt("Wrong number of arguments to function AO_Configure");
  short _arg_slot;
  short _arg_chan;
  short _arg_outputPolarity;
  short _arg_IntOrExtRef;
  double _arg_refVoltage;
  short _arg_updateMode;
  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 outputPolarity");
  if (!_get_numeric(prhs[3], &_arg_outputPolarity))
    mexErrMsgTxt("Expecting numeric scalar for argument outputPolarity");

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

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

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

  plhs[0] = mxCreateDoubleMatrix(1, 1, mxREAL);
    _arg_retval = (short)
      AO_Configure(_arg_slot, _arg_chan, _arg_outputPolarity, _arg_IntOrExtRef, _arg_refVoltage, _arg_updateMode);
  *mxGetPr(plhs[0]) = (double)_arg_retval;
}

void _wrap_AO_Update(int nlhs, mxArray **plhs, int nrhs, const mxArray **prhs)
{
  if (nlhs > 1 ||
      nrhs != 1+1)
    mexErrMsgTxt("Wrong number of arguments to function AO_Update");
  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)
      AO_Update(_arg_slot);
  *mxGetPr(plhs[0]) = (double)_arg_retval;
}

void _wrap_AO_VScale(int nlhs, mxArray **plhs, int nrhs, const mxArray **prhs)
{
  if (nlhs != 2 ||
      nrhs != 3+1)
    mexErrMsgTxt("Wrong number of arguments to function AO_VScale");
  int _d[4] = { 1,1,1,1 };
  int _vec_n = 0;
  int _vidx;
  int _vec_sz;
  short *_arg_slot;
  short *_arg_chan;
  double *_arg_voltage;
  short *_arg_value;
  short *_arg_retval;
  int _vecstride_slot = 1;
  int _vecstride_chan = 1;
  int _vecstride_voltage = 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_voltage))
    mexErrMsgTxt("Error in dimension of argument voltage");
  if (mxIsDouble(prhs[3]))
    _arg_voltage = mxGetPr(prhs[3]);
  else
  {
    _arg_voltage = MEM_ALLOC(double *, _arraylen(prhs[3]), sizeof (double));
    if (!_get_numeric(prhs[3], _arg_voltage))
      mexErrMsgTxt("Expecting numeric matrix for argument voltage");
  }

  {
    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_value = MEM_ALLOC(short *, _arraylen(plhs[1]), sizeof (short));
  }
  _vec_sz = _d[0]*_d[1]*_d[2]*_d[3];
  for (_vidx = 0; _vidx < _vec_sz; ++_vidx) {
    _arg_retval[_vidx] = (short)
      AO_VScale(_arg_slot[_vecstride_slot*_vidx], _arg_chan[_vecstride_chan*_vidx], _arg_voltage[_vecstride_voltage*_vidx], &_arg_value[_vidx]);
  }
  {
    int _fidx;
    double *d_ptr = mxGetPr(plhs[0]);
    for (_fidx = 0; _fidx < _arraylen(plhs[0]); ++_fidx)
      *d_ptr++ = (double)*_arg_retval++;
  }
  {
    int _fidx;
    double *d_ptr = mxGetPr(plhs[1]);
    for (_fidx = 0; _fidx < _arraylen(plhs[1]); ++_fidx)
      *d_ptr++ = (double)*_arg_value++;
  }
}

void _wrap_AO_VWrite(int nlhs, mxArray **plhs, int nrhs, const mxArray **prhs)
{
  if (nlhs > 1 ||
      nrhs != 3+1)
    mexErrMsgTxt("Wrong number of arguments to function AO_VWrite");
  short _arg_slot;
  short _arg_chan;
  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 voltage");
  if (!_get_numeric(prhs[3], &_arg_voltage))
    mexErrMsgTxt("Expecting numeric scalar for argument voltage");

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

void _wrap_AO_Write(int nlhs, mxArray **plhs, int nrhs, const mxArray **prhs)
{
  if (nlhs > 1 ||
      nrhs != 3+1)
    mexErrMsgTxt("Wrong number of arguments to function AO_Write");
  short _arg_slot;
  short _arg_chan;
  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 value");
  if (!_get_numeric(prhs[3], &_arg_value))
    mexErrMsgTxt("Expecting numeric scalar for argument value");

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

void _wrap_Align_DMA_Buffer(int nlhs, mxArray **plhs, int nrhs, const mxArray **prhs)
{
  if (nlhs != 2 ||
      nrhs != 4+1)
    mexErrMsgTxt("Wrong number of arguments to function Align_DMA_Buffer");
  short _arg_slot;
  short _arg_resource;
  short *_arg_buffer;
  unsigned long _arg_cnt;
  unsigned long _arg_bufSize;
  unsigned long _arg_alignIndex;
  short _arg_retval;
  _arg_cnt = (_dim(prhs[3], 0));
  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 resource");
  if (!_get_numeric(prhs[2], &_arg_resource))
    mexErrMsgTxt("Expecting numeric scalar for argument resource");

  if (_n_dims(prhs[3]) > 1)
    mexErrMsgTxt("Error in dimension of argument buffer");
  if (mxIsInt16(prhs[3]) || mxIsUint16(prhs[3]))
    _arg_buffer = (short *)mxGetData(prhs[3]);
  else
  {
    _arg_buffer = MEM_ALLOC(short *, _arraylen(prhs[3]), sizeof (short));
    if (!_get_numeric(prhs[3], _arg_buffer))
      mexErrMsgTxt("Expecting numeric matrix for argument buffer");
  }

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

  plhs[0] = mxCreateDoubleMatrix(1, 1, mxREAL);
  plhs[1] = mxCreateDoubleMatrix(1, 1, mxREAL);
    _arg_retval = (short)
      Align_DMA_Buffer(_arg_slot, _arg_resource, _arg_buffer, _arg_cnt, _arg_bufSize, &_arg_alignIndex);
  *mxGetPr(plhs[0]) = (double)_arg_retval;
  *mxGetPr(plhs[1]) = (double)_arg_alignIndex;
}

void _wrap_CTR_Config(int nlhs, mxArray **plhs, int nrhs, const mxArray **prhs)
{
  if (nlhs > 1 ||
      nrhs != 6+1)
    mexErrMsgTxt("Wrong number of arguments to function CTR_Config");
  short _arg_slot;
  short _arg_ctr;
  short _arg_edgeMode;
  short _arg_gateMode;
  short _arg_outType;
  short _arg_outPolarity;
  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 ctr");
  if (!_get_numeric(prhs[2], &_arg_ctr))
    mexErrMsgTxt("Expecting numeric scalar for argument ctr");

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

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

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

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

  plhs[0] = mxCreateDoubleMatrix(1, 1, mxREAL);
    _arg_retval = (short)
      CTR_Config(_arg_slot, _arg_ctr, _arg_edgeMode, _arg_gateMode, _arg_outType, _arg_outPolarity);
  *mxGetPr(plhs[0]) = (double)_arg_retval;
}

void _wrap_CTR_EvCount(int nlhs, mxArray **plhs, int nrhs, const mxArray **prhs)
{
  if (nlhs > 1 ||
      nrhs != 4+1)
    mexErrMsgTxt("Wrong number of arguments to function CTR_EvCount");
  short _arg_slot;
  short _arg_ctr;
  short _arg_timebase;
  short _arg_cont;
  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 ctr");
  if (!_get_numeric(prhs[2], &_arg_ctr))
    mexErrMsgTxt("Expecting numeric scalar for argument ctr");

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

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

  plhs[0] = mxCreateDoubleMatrix(1, 1, mxREAL);
    _arg_retval = (short)
      CTR_EvCount(_arg_slot, _arg_ctr, _arg_timebase, _arg_cont);
  *mxGetPr(plhs[0]) = (double)_arg_retval;
}

void _wrap_CTR_EvRead(int nlhs, mxArray **plhs, int nrhs, const mxArray **prhs)
{
  if (nlhs != 3 ||
      nrhs != 2+1)
    mexErrMsgTxt("Wrong number of arguments to function CTR_EvRead");
  short _arg_slot;
  short _arg_ctr;
  short _arg_overflow;
  unsigned short _arg_counts;
  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 ctr");
  if (!_get_numeric(prhs[2], &_arg_ctr))
    mexErrMsgTxt("Expecting numeric scalar for argument ctr");

⌨️ 快捷键说明

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