- From: Chuck Haines <chaines_at_gmail.com>
- Date: Mon, 26 Jul 2004 11:01:43 -0400
Does anyone know what subdevice and channel I need for the GPCT0 on an
National Instruments DAQCard 6024E? I'm currently using subdevice 7
and channel 8, but it's not working. Here is the code I'm using to
set up the counter:
for(i = 0; i < 7; i++)
{
switch(i)
{
case 0:
op[0] = GPCT_DISARM;
break;
case 1:
/* Reset the counter */
op[0] = GPCT_RESET;
break;
case 2:
/* Set the source to the external pin */
op[0] = GPCT_SET_SOURCE;
/* Set the source to the internal timer */
/* op[1] = GPCT_INT_CLOCK; */
op[1] = GPCT_EXT_PIN;
break;
case 3:
/* Set the gate to latch to the external pin */
op[0] = GPCT_SET_GATE;
/* op[1] = GPCT_EXT_PIN; */
/* No latch on the gate */
op[1] = GPCT_NO_GATE;
break;
case 4:
/* Every event causes the counter to increase */
op[0] = GPCT_SET_DIRECTION;
op[1] = GPCT_UP;
break;
case 5:
op[0] = GPCT_SET_OPERATION;
op[1] = GPCT_SIMPLE_EVENT;
break;
case 6:
op[0] = GPCT_ARM;
break;
}
insn.insn = INSN_CONFIG;
if(i == 0 || i==1 || i==6) insn.n=1; else insn.n=2;
insn.data = op;
insn.subdev = 7;
insn.chanspec = CR_PACK(8, 0, 0);
/* perform configure */
if ( ( comedi_do_insn(card, &insn) ) < 0 )
printf ( "Error performing insn: %s\n", comedi_strerror (
comedi_errno() ) );
}
However all I'm getting is invalid argument as an error to everyone
config. Any help would be much appreciated.
Chuck
--
Chuck Haines
chaines_at_gmail.com
-------------------------------------------
Tau Kappa Epsilon Fraternity
WPI Class of 2005
-------------------------------------------
AIM: CyberGrex
YIM: CyberGrex_27
ICQ: 3707881
-------------------------------------------
Received on 2004-07-26Z14:01:43