TRIG_EXT

Hi

I wanted to use an external Signal to start an image capture. Therefore I 
used a digital I/O port of a National Instruments pci-1200. I'm not exactly 
sure how to use comedi to trigger on this external signal.

I tried the following but it didn't work:

#include <stdio.h>
#include <comedilib.h>


unsigned int gl_chanlist[16];
const unsigned int gl_subdevice = 2;



/* aus demo/ledclock.c: */
void
prepare_cmd(comedi_t *dev, comedi_cmd *cmd)
{
memset(cmd, 0, sizeof(*cmd));

/* the subdevice that the command is sent to */
cmd->subdev = gl_subdevice;

/* flags */
cmd->flags = 0;

cmd->start_src = TRIG_NOW;
cmd->start_arg = 0;

cmd->scan_begin_src = TRIG_EXT;
cmd->scan_begin_arg = 0;

cmd->convert_src = TRIG_ANY;
cmd->convert_arg = 0;

cmd->scan_end_src = TRIG_COUNT;
cmd->scan_end_arg = 1;

cmd->stop_src = TRIG_NONE;
cmd->stop_arg = 0;

cmd->chanlist = gl_chanlist;
cmd->chanlist_len = 1;

gl_chanlist[0] = CR_PACK(0, 0, 0);
}



int
main()
{
comedi_t *it;
comedi_cmd command;
int re;


it = comedi_open("/dev/comedi0");

prepare_cmd(it, &command);

re = comedi_command(it, &command); /*this should wait until there is a "1" 
on subdev 2, chan 0 of the pci-1200 device*/

printf("comedi_command returned %d\n", re); /*this will be replaced by the 
image capture funktion*/


return 0;
}

Does anybody know how I have to use TRIG_EXT, or if there is an easier 
solution.

Thanks

Markus

Received on 2002-08-23Z15:10:35