- From: Daniel Ben Dayan Rubin <dbd_at_biomed.polimi.it>
- Date: Fri, 6 Jun 2003 19:53:50 +0000 (GMT)
Hallo everybody,
I have to change the range from -5V - 5V to a more suitable range of 0V -
10V, or better 0V - 5V. I have the ni_labPC board. I tried using the
comedi_get_range() function passing argument
range=1
for having the range set on the 0 -10 scale. This thing does not works while
I'm trying to write this value on the board, I'm still measuring the
range -5 - 5 V, even if I'm telling the board to wirte values between 0V -
9.99V
Does anybody has an idea how can I simply manipulate the range to the
desired one? Should I set the comedi_krange structure? how?
thanks,
Regards,
Daniel
here's my sample code:
int subdev = 1;
int chan = 1;
int range = 1; //range between 0 and 10.. hopefully...
int aref = AREF_GROUND;
lsampl_t data;
comedi_t *device;
comedi_range *rangeC;
float PHYdata = 9.99; //set this to change the desired output
device=comedi_open("/dev/comedi0");
rangeC = comedi_get_range( device,
subdev,
chan,
range);
printf("CRange - min: %f max: %f unit: %d\n",
rangeC->min, rangeC->max, rangeC->unit);
int maxdata = comedi_get_maxdata(device, subdev, chan);
data=comedi_from_phys(PHYdata,rangeC,maxdata);
comedi_data_write( device,
subdev,
chan,
range,
aref,
data);
Received on 2003-06-06Z18:53:50