Analog Output, Comedi+RTAI+Matlab

Hello!

I am currently working on a driver for the precision microdynamic's card 
MFIO-3A for comedi support. Some of the functions are already working 
and I am using comedi in combination with RTAI and Matlab. For one 
special application however, I need the integer value from the channel's 
register of an analog output in my matlab simulink simulation.

First i tried to uncomment the s->maxdata and s->range_table hoping that 
the values would not be scaled between -10 to 10. When i started my 
files (code generated by Matlabs Real Time Workshop), the analog input 
was automatically scaled between 0 to 1 and I when I use xrtailab to 
watch the analog input with a scope or meter I get an error message 
similar to "out of range" (i cant remember exactly at the moment). 

Here's a part of the driver's code.

 s = dev->subdevices + 0;
 /* ai subdevice */
s->type = COMEDI_SUBD_AI;
s->subdev_flags = SDF_READABLE;
s->n_chan = 3;
s->insn_read = mfio_ai_insn_read;
//s->maxdata = 0x7fff;
//s->range_table = &range_bipolar10;

I'd really appreciate your help or any hints and tips,
best regards,
Roland

Received on 2005-11-10Z16:34:20