NI 6034E, EXT_TRIG

Hello,

i have an NI 6034E card and the actual comedilib. Now i'm testing the card to 
understand how comedi works.
But i have problems. I want to make an simple A/D conversion (only one) which 
ist triggert extern.
For this i changed the prepare_cmd() - function from the example receiver.c, 
into three examples functions.
Extern trigger with
- start_src
- scan_begin_src or
- scan_convert_src

Please, see below.

The prepare_cmd_start works (but it makes more than one scan!). The other 
functions don't work.
I've checked it with different PFI's, but nothing happend.
What is wrong ? I'd read in ni_mio_common.c, but for me, there is nothing 
special to do.

Can somebody help me ? I've found one entry (from 20 Nov. 2001) in this 
mailing list, but it doesn't help me.
I don't see my mistake.


Thanks

Martin

----------------------------------- examples 
--------------------------------------------
pin_data is 0 !
subdevice is 0 !

unsigned int chanlist[16];

#define PFI0	0
#define PFI1	1
#define PFI2	2
#define PFI3	3
#define PFI4	4
#define PFI5	5
#define PFI6	6
#define PFI7	7


void prepare_cmd_start(comedi_t *dev,comedi_cmd *cmd)
{
	memset(cmd,0,sizeof(comedi_cmd));

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

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

	cmd->start_src =	TRIG_EXT;
	cmd->start_arg =	((1<<31)|PFI0);

	cmd->scan_begin_src =	TRIG_TIMER;
	cmd->scan_begin_arg =	1;

	cmd->convert_src =	TRIG_TIMER;
	cmd->convert_arg =	1;

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

	cmd->stop_src =		TRIG_COUNT;
	cmd->stop_arg =		1;

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

	chanlist[0]=CR_PACK(pin_data,0,0);
}



void prepare_cmd_scan(comedi_t *dev,comedi_cmd *cmd)
{
    memset(cmd,0,sizeof(comedi_cmd));

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

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

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

    cmd->scan_begin_src =   TRIG_EXT;
    //cmd->scan_begin_arg =   ((1<<31)|PFI0);
    cmd->scan_begin_arg =   ((1<<31)|PFI7);

    cmd->convert_src =  TRIG_TIMER;
    cmd->convert_arg =  1;

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

    cmd->stop_src =     TRIG_COUNT;
    cmd->stop_arg =     1;

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

    chanlist[0]=CR_PACK(pin_data,0,0);
}



void prepare_cmd_convert(comedi_t *dev,comedi_cmd *cmd)
{
    memset(cmd,0,sizeof(comedi_cmd));

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

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

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

    cmd->scan_begin_src =   TRIG_TIMER;
    cmd->scan_begin_arg =   1;

    cmd->convert_src =  TRIG_EXT;
    cmd->convert_arg =  ((1<<31)|PFI2);
    //cmd->convert_arg =  ((1<<31)|PFI0);
    //cmd->convert_arg =  PFI2;

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

    cmd->stop_src =     TRIG_COUNT;
    cmd->stop_arg =     1;

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

    chanlist[0]=CR_PACK(pin_data,0,0);
}

Received on 2003-05-24Z14:06:43