Problems with dio for PCI-DAS6034...

I'm having 
problems with my dio. I have a momentary switch connected to dio chan 0 on
subdevice 4 and i always get an output of 1. I have the common on the switch
connected to boards dio ground, the normally open of switch connected to dio
chan 0 and to +5V with 1k resistor in series (this is pin 39 on my board).
I've spoke with measurement computing (MC) about the connectivity of the
switch and 
it is right so this leads me to comedi. 

According to MC the dio once set to input is set as logic high. So when I
get activity on the dio that i've set as input it should read 0. Below is my
modified demo/dio.c program. Thanks!!! 

#include <stdio.h> 
#include <comedilib.h> 
#include <fcntl.h> 
#include <unistd.h> 
#include <stdlib.h> 
#include <errno.h> 
#include <getopt.h> 
#include <ctype.h> 

comedi_t *device; 
lsampl_t data; 

int main(int argc, char *argv[]) 
{ 
   int ret, dout; 
   int stype; 

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

   ret=comedi_dio_config(device,4,0,COMEDI_OUTPUT); 

   dout = comedi_dio_read(device,4,0,&data); 
   printf("DIO chan: %d output: %d\n",0,dout); 

   return 0; 
}

 

Thanks,

 

Eric

 

Received on 2005-02-26Z20:51:40