using an external trigger on NI PCI 6036E

Hi,

I am fairly new at data acquisition and Linux.
I am using comedilib 0.7.20 and comedi 0.7.66.

I am able to read and write to both analog and digital channels and I 
can perform continuous acquisition using comedi_command.

Ok, here is the question:

I want to use an external trigger to start an acquisition. This is what 
I have, and it doesn't work

{
    ...
    // I set all the DIO channels (subdevices 2 and 7) as input.

    // create the command structure
    memset(&cmd, 0,sizeof(cmd));
    cmd.subdev = 0;
    cmd.flags = 0;
    cmd.start_src = TRIG_EXT;
    cmd.start_arg = 0;
    cmd.scan_begin_src = TRIG_TIMER;
    cmd.scan_begin_arg = 1e9*sampling_period;
    cmd.convert_src = TRIG_TIMER;
    cmd.convert_arg = 5000;
    cmd.scan_end_src = TRIG_COUNT;
    cmd.scan_end_arg = nchan;
    cmd.stop_src = TRIG_COUNT;
    cmd.stop_arg = totalsamples;
   
    cmd.chanlist = chanlist;
    cmd.chanlist_len = nchan;
   
    // test the command
    int ret = comedi_command_test(Dev, &cmd);
    if (ret != 0)
    {
        printf("An error occured in the command\n");
        exit(-1);
    }
   
    //make sure we are still using the same number of samples
   
    totalsamples = cmd.stop_arg;
    lsampl_t *data = new lsampl_t[totalsamples];
    int samples_read = 0;
    int buff_size = 32;
    char *buff = new char[buff_size];
   
    if (comedi_command(Dev, &cmd)<0)
    {
        comedi_perror("Comedi command not sent");
        exit(-1);
    }

    ... read from /dev/comedi0 and do whatever...
}

as I understand it, as soon as there is a rising or falling edge to 
PFI0, the board should start the acquisition.

As of now, no errors are returned by any comedi functions, nor by the 
read function. The read function just waits for data to become 
available. Everything works if I set the trigger to TRIG_INT and send a 
software trigger.

Thanks,
 Marc

Received on 2004-01-23Z18:59:30