- From: Ian Abbott <abbotti_at_mev.co.uk>
- Date: Fri, 21 Oct 2005 09:46:54 +0100
On 19/10/2005 22:06, Eric Hudson wrote: > I have a PCI-DAS6034 card and I’m currently using it along with comedi > to read from 1 adc and dio chan. I now need to write to another dio chan > and my question is how to do this. If I’m not mistaken I thought you > could only configure subdevices as read or write but not both. Below is > the code I’m using: For DIO subdevices you can use comedi_dio_config to configure which channels are inputs and which are outputs, subject to hardware limitations; for some devices the channel directions can only be assigned in groups, not individually - 8255 subdevices for example. > For DIO read: > > comedi_data_read(device,5,0,0,AREF_GROUND,&data2); It's better to use comedi_dio_read or comedi_dio_bitfield. > For ADC read: > > maxdata = comedi_get_maxdata(device, ADCSUBDEV, ADCCHAN); > > cr = comedi_get_range(device, ADCSUBDEV, ADCCHAN, ADCRANGE); > > comedi_data_read(device, ADCSUBDEV, ADCCHAN, ADCRANGE, > ADC_AREF, &data); > > To write out to dio chan would I simply do: > comedi_data_write(device,5,2,0,AREF_GROUND,&data2); every time I wanted > to write out to dio chan? It's better to use comedi_dio_write or comedi_dio_bitfield. -- -=( Ian Abbott _at_ MEV Ltd. E-mail: <abbotti_at_mev.co.uk> )=- -=( Tel: +44 (0)161 477 1898 FAX: +44 (0)161 718 3587 )=-
Received on 2005-10-21Z07:46:54