Analog Input via "Commands"

[RTAI-vesuvio;  comedi-CVS; NI PCI-MIO]

I'm trying to get a simple test program to work that uses COMEDI's
command structure.  The idea is to digitize 8 samples (NUMSAMPLES) on
channel0 at 1kHz.  Here's the "command code" contained within init_module():

    // Setup command structure
    chanlist[0]         = CR_PACK(CHAN0,RNGB10,AREF_DIFF);
  
    cmd->subdev         = ADC;             // 0
    cmd->chanlist       = chanlist;
    cmd->chanlist_len   = 1;
  
    cmd->start_src      = TRIG_NOW;        // begin immediately
    cmd->start_arg      = IGNORED;
  
    cmd->scan_begin_src = TRIG_TIMER;      // start via NI timer
    cmd->scan_begin_arg = 1000000;         // sample at 1kHz
  
    cmd->convert_src    = TRIG_TIMER;
    cmd->scan_end_src   = TRIG_COUNT;      // stop "scan" after one sample
    cmd->scan_end_arg   = 1;
  
    cmd->stop_src       = TRIG_COUNT;      // stop operation after `N' samples
    cmd->stop_arg       = NUMSAMPLES;
  
    cmd->data           = sample;
    cmd->data_len       = sizeof(sample);
  
    // Test the command
    ret=comedi_command_test(das,cmd);
    if(ret<0){
      rt_printk("bad COMEDI command!\n");
      return -1;       
    }
  
    // Execute the command
    comedi_command(das,cmd);

Unfortunately, repeated executions produce *exactly* the same data
... making me very suspicious!  Here's what I see in 'dmesg':

    33060
    0
    0
    64
    60688
    49218
    16384
    7

Is there something wrong in 'cmd'?  Or, might you have other ideas?

Thanks,
-- 
Prof Kenneth H Jacker       khj_at_cs.appstate.edu
Computer Science Dept       www.cs.appstate.edu/~khj
Appalachian State Univ
Boone, NC  28608  USA        

Received on 2005-04-08Z12:52:07