Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

DAQmx individual tasks per line, lines being overwritten

I am using DAQmx to control a DIO-96 card in CVI 8.0.  To not have to store line states and provide maximum flexibility I am configuring each line on a port as a channel that is held by its own task.  Thus, a task only controls a signal line.  I loop through a table creating and configuring the tasks and I encounter an issue when multiple ports are involved.  For instance, if I create and configure the lines on Port 1 and Port 2 when I call DAQmxWriteDigitalLines and pass a state of 0 or 1 it affects the other port.  So, I configured both ports and then write default states to both ports.  Port 0 is an input port in case that is pertinent.  Port 1 is written to first ( only 2 lines - all that's configured ) and then Port 2.  Port 1's state is lost when Port 2 is written to.  Any ideas? Thanks.
-G-
0 Kudos
Message 1 of 4
(3,533 Views)
Testing using NI MAX shows the following.
    Reset card
    Test panels
          Case 1
          Configure port 1 as outputs
          Configure port 2 as outputs
          Start task(s)
          Set port 1 lines
          Select port 2 to set lines ( here port 1's settings are cleared )

    Reset card
    Test panels
          Case 2
          Configure port 1 as outputs
          Start task(s)
          Set port 1 lines
          Stop task(s)
          Configure port 2 as outputs
          Start task(s) ( here port 1's settings are cleared )

    Reset card
    Test panels
          Case 3
          Start task(s)
          Configure port 1 as outputs
          Configure port 2 as outputs
          Set port 1 lines
          Set port 2 lines
          Stop task(s)
          WORKS!!!!

Thus, that makes me think it has something to do with the autostart feature of tasks.  Does anyone know how many tasks MAX creates and how they're configured when using the Test Panels feature?  I think with that information I can find a way to make this all work.  Thanks.
-G-
   
         

Message Edited by Grasshopper on 05-29-2007 02:20 PM

-G-
0 Kudos
Message 2 of 4
(3,530 Views)
Okay, to not guess as to what to do, I decided to start all the tasks, write to them all, and stop them all.  From then on, you can write to them using the autostart feature and all is well.   Just don't reset the card! 🙂
-G-
0 Kudos
Message 3 of 4
(3,524 Views)
Hello Grasshopper-
 
It sounds like you're experiencing a limitation of the 82C55 DIO chip on that board.  It's described here (in outdated Traditional NI-DAQ terms), but it sounds like you've already found the equally-effective NI-DAQmx workaround; you simply need to configure all ports before you ever attempt to write to any of them individually.  As you said, if you reset the device your configuration will be lost, so you should always ensure that your device configuration is "fresh" before you attempt to write to the lines.
 
Hopefully this helps-
Tom W
National Instruments
0 Kudos
Message 4 of 4
(3,517 Views)