Exemple #1
0
int DaqDevice::writeData(int subdev,int channel, int range_idx,int aref,double value)
{
    lsampl_t raw;

    raw = comedi_from_physical(value,&_converter_an_output[channel]);

    if (comedi_data_write(_dev, subdev, channel, range_idx, aref,raw) < 0)
    {
        return COMEDI_ERROR;
    } else {
        return COMEDI_OK;
    }
}
Exemple #2
0
void ComediAnalogOutputSoftCal::write(double data)
{
	double sample = data*m_outputConversionFactor;
#ifdef TRIM_ANALOG_OUTPUT
	if (sample <= m_dataRange->min) {
		sample = m_dataRange->min + 0.01*(m_dataRange->max-m_dataRange->min);
		//Logger(Debug, "[%f] - Trimming lower limit of the DAQ card.\n", GetGlobalTime());
	}
	if (sample >= m_dataRange->max) {
		sample = m_dataRange->max - 0.01*(m_dataRange->max-m_dataRange->min);
		//Logger(Debug, "[%f] - Trimming upper limit of the DAQ card.\n", GetGlobalTime());
	}
#endif
        comedi_data_write(m_device, m_subdevice, m_channels[0], m_range, m_aref,
                comedi_from_physical(sample, &m_converter));
}
// Write the argument to the output of the DAQ board.
void AnalogyAnalogOutputSoftCal::write(double data)
{
        comedi_data_write(m_device, m_subdevice, m_channels[0], m_range, m_aref,
                comedi_from_physical(data*m_outputConversionFactor, &m_converter));
}
Exemple #4
0
lsampl_t from_phys(double x) {
    return comedi_from_physical(x, &conv_ao);
    //return llround((x+10)*((double) 100)/20); //comedi_from_phys(x, rangeai, maxdataai);
}