- From: Maarten Egmond <megmond_at_genoa.com>
- Date: Wed, 12 Jun 2002 14:50:50 +0200
Dear all,
The last few weeks I have been evaluating both RTAI and Comedi for use for a particular real-time data acquisition application. I finally managed to get everything working, though there is still something that I do not understand and another question.
I currently use RTAI 24.1.9 and Comedi 0.7.65 (and Comedilib 0.7.18).
In the attached example code (feel free to modify/include it in the distribution of either/both RTAI and Comedi - I think the comments in it and the simplicity of the example will be a great help for many newbies) I set up a real-time task, and I use Comedi to perform DAQ inside this task.
Currently the code uses an 'instruction' (comedi_do_insn) to do the single data write to an analog output on my NI-6035E card (and this works perfectly). Before this, I have been attempting to use the comedi_data_write() routine instead:
r=comedi_data_write(daq,1,0,0,AREF_GROUND,sample);
if (r)
rt_printk("Error: %d\n",r);
The documentation claims the comedi_data_write() will return 0 on success, and -1 on failure. However, I consistently got it to return +1 which I considered to be an error (I believe - not 100% sure - the analog output also did not show the expected signal, which would confirm this).
Earlier examples I made/tested without real-time (simple user-space program like the outp example) worked fine with comedi_data_write().
Is there any reason why comedi_data_write() can not be used in kernel/realtime mode in the way that I have tried it? I might be missing something obvious, but I have only recently started using linux and still a bit confused by the exact differences between kernel and userspace.
My other question is this: I saw in the documentation that commands (which my card/driver apparently does not support - as shown by the 'info' program) can be emulated by using RTAI. Since I use RTAI myself for a real-time task, I wonder if the comedi-command-emulation will interfere with this task, or that I have to be careful with certain things to make sure I don't stuff it up...
Thanks for any info.
Kind regards,
Maarten Egmond
Phone +31-(0)40-750-2035
Genoa BV - http://www.genoa.com
Attachments
- application/x-compressed attachment: realtimewave.zip
Received on 2002-06-12Z11:50:50