- From: Alan Chen <alanchen_at_MIT.EDU>
- Date: Tue, 24 Sep 2002 18:10:29 -0400
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
To All,
I am having a troublesome problem with comedi and/or the dio board . It
seems that I must perform some akward operations for the board to work
correctly.
So I am trying to set all the channels (0-23) in all the subdevices
(0-3) to either 1 or 0. It turns out that the following graph is what I
get (source pasted below):
comedi_dio_write(...,0) followed by a comedi_config(...,COMEDI_INPUT) gets 1
comedi_dio_write(...,1) followed by a comedi_config(...,COMEDI_INPUT) gets 1
comedi_dio_write(...,0) alone gets 0
comedi_dio_write(...,1) alone gets a random amount of 1's and 0's
~ (although they seem clustered)
I am using kernel 2.4.16, comedi-0.7.65, and comedilib-0.7.19. Any clues?
Sincerely,
Alan
ph: 617-252-1847
alanchen_at_mit.edu
lspci -v output:
- -----------------
00:0d.0 Class ff00: National Instruments PCI-DIO-96
~ Flags: bus master, medium devsel, latency 32, IRQ 12
~ Memory at df001000 (32-bit, non-prefetchable) [size=4K]
~ Memory at df002000 (32-bit, non-prefetchable) [size=4K]
dmesg output:
- ----------------
comedi: version 0.7.65 - David Schleef <ds_at_schleef.org>
Available NI device IDs: 0x0160
comedi0: nidio:<6>PCI: Found IRQ 12 for device 00:0d.0
MITE:0xdf001000 mapped to fda4c000 DAQ:0xdf002000 mapped to fda4e000
~ pci-dio-96
example source code:
- --------------------------
#include <comedilib.h>
// Tests 1
int main (int argc, char *argv[]) {
~ comedi_t *dev;
~ int i,k;
~ unsigned int value=1;
~ dev=NULL;
~ dev = comedi_open("/dev/comedi0");
~ if (dev==NULL){
~ printf("failed to open device\n");
~ exit(0);
~ }
~ for ( i=0 ; i<4 ; i++ ) {
~ for ( k=0 ; k<24 ; k++ ) {
~ comedi_dio_config(dev,i,k,COMEDI_OUTPUT);
~ comedi_dio_write (dev,i,k,value);
~ comedi_dio_config(dev,i,k,COMEDI_INPUT);
~ }
~ }
~ fprintf(stdout,"done! : test_1\n");
~ comedi_close(dev);
}
// Tests 0
#include <comedilib.h>
int main (int argc, char *argv[]) {
~ comedi_t *dev;
~ int i,k;
~ unsigned int value=0;
~ dev=NULL;
~ dev = comedi_open("/dev/comedi0");
~ if (dev==NULL){
~ printf("failed to open device\n");
~ exit(0);
~ }
~ for ( i=0 ; i<4 ; i++ ) {
~ for ( k=0 ; k<24 ; k++ ) {
~ comedi_dio_config(dev,i,k,COMEDI_OUTPUT);
~ comedi_dio_write (dev,i,k,value);
~ }
~ }
~ fprintf(stdout,"done! : test_0\n");
~ comedi_close(dev);
}
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iEYEARECAAYFAj2Q4tQACgkQhc/W5+RxC92VXwCgrakYLYTGpbiTF6akhdNbnZ43
DP0AoKa5lUtW5sBp9TZMpk+qREHIIDm4
=uPk0
-----END PGP SIGNATURE-----
Received on 2002-09-24Z21:10:29