Hi, Dave,
First, I am very grateful for your and listers' very kind assistance to help
me to setup well my NI PCI6035E. Now, I could do something with this DAQ card,
such as Analog(Digital) input/output in the user space. However, when I turn
to kernel space, I met with some difficulty. Here please allow me to list
some related description on my PCI6035E as follows:
1) For User Space Usage:
--Mode 0 is OK by using "comedi_trigger", and I could get correct Analog Input
data from several AI channels, but if I modifiy the codes for Mode 2, I could
not get correct AI result, only could get "0" as result.
--Mode 2 is OK by using "comedi_timed_1chan", and I could also get correct AI
result.
2) For Kernel Space Usage:
--Mode 0 is OK for me to output digital 0/1 signals on Digtal I/O channels.
--Mode 0 is also OK for me to output Analog signals on AO channels.
--However, still for Mode 0, if I modify the codes to collect Analog Input
signals, my computer will freeze every time. Attached please find the very
simple program (which is just like Chuck's "mimic_ai.c"), its purpose is just
to read Analog Input from AI channel 0.
For kernel space usage, it seems that the trig structure is ok for writing or
output signal through the PCI6035E, once I try to read signals, my computer
freeze. However, I think there should be no hardware problems since all are
OK to read or collect AI data in user space usage.
I could understand that you are quite busy to respond so many questions in the
mailing list, but I really need your kind help on this point since I have
tried it for about 10 days and still no result yet. Thank you all again.
Kind regards,
Yuhong
David Schleef wrote:
> On Tue, Oct 03, 2000 at 02:40:49PM -0400, [EMAIL PROTECTED] wrote:
> > I remember a couple of weeks back some discussion on the PCI6035
> > drivers - if I recall correctly they were just written and could be quite
> > bug ridden. It may be that no one has used them for real time AI at
> > all. Does anybody know? Anyone using the PCI6035E for hard real time AI?
>
> Sorry I've been so quiet about this thread, but I am a) busy, and
> b) clueless. But I have two questions: Does it work with older
> versions, and does similar code work from user space?
>
> dave...
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/version.h>
#include <rtl_sched.h>
#include <rtl_compat.h>
#include <rtl_printf.h>
#include <asm/rt_time.h>
#include <comedi.h>
/* this is the dev,subdev for analog input on my NI PCI6035E board */
unsigned int dev=0;
unsigned int subdev=0;
pthread_t mythread;
sampl_t data;
comedi_trig trig;
int ioctl_check;
unsigned int channel;
void *do_comedi_toggle(void *arg)
{
while(1){
ioctl_check=comedi_trig_ioctl(dev,subdev,&trig);
rtl_printf("analog intput: scan= %d\n",data);
pthread_wait_np ();
}
}
int init_module(void)
{
int ret;
channel=CR_PACK(0,0,0);
/* set up trigger structure */
trig.subdev=subdev;
trig.mode=0;
trig.flags=0;
trig.n_chan=1;
trig.chanlist=&channel;
trig.data=&data;
trig.data_len=sizeof(sampl_t);
trig.n=1;
trig.trigsrc=0;
trig.trigvar=0;
trig.trigvar1=0;
/* IMPORTANT: next step: lock the subdevice */
ret=comedi_lock_ioctl(dev,subdev);
pthread_create(&mythread, NULL, do_comedi_toggle, 0);
pthread_make_periodic_np(mythread, gethrtime(), 500000000); //0.5s
return 0;
}
void cleanup_module(void)
{
int ret;
ret=comedi_cancel_ioctl(dev,subdev);
ret=comedi_unlock_ioctl(dev,subdev);
ret=pthread_delete_np(mythread);
}