Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

functions from dll's

I'm tring to create console application, that set number of output lines of NI6527 to needed values.

I'm using ni-daq functions(Dig_Line_Out...) from dll's (in Visual studio 6)and it works, but when the application ends(exits), all output lines return to it's default value(high).

How can i solve this program?

Thanks
0 Kudos
Message 1 of 11
(4,672 Views)
Hello Toliks,

When power is being supplied to the NI PCI-6257, the solid-state relays should maintain the last value being written to them.  When power is removed from the device there is no way to keep the relays from going to their default state of open.  You can however use the following utility to have the device quickly switch to a user defined state quickly after powering up.  Take a look at the following Knowledgebase and the attached utility for configuring the powerup states of the NI PCI-6257.

Configurable Power-Up States for NI 6527 Devices

Regards,
Travis G.
0 Kudos
Message 2 of 11
(4,650 Views)
I don't remove power supply from device.
After closing of my application the device returns to his default state and this is a problem.
0 Kudos
Message 3 of 11
(4,642 Views)
Toliks,

Are you first calling Dig_Line_Config in your program to set a line as output?  Are there any unnecessary configuration calls used to clean up your task when closing your program?  Go ahead and post your VB 6.0 code so we can take a look at it. 

Travis G.
0 Kudos
Message 4 of 11
(4,628 Views)

It's not a VB but VC code:

void main( int argc, char *argv[])
{
 // Define local variablres
    short iStatus = 0;
    short iRetVal = 0;
    short iDevice = 0;
    short iPort = 0;
    short iLine = 0;
    short iDir = 0;
    short iState = 0;
    short iIgnoreWarning = 0;
    enum enum_Direction
   {
       In=0,
       Out
    };
    enum_Direction enDir = Out;
     iLine = 6

    iDevice = 1

    iPort = 5

    // Configure Port to output
    iStatus = DIG_Prt_Config (iDevice, iPort, 0, enDir);

    iRetVal = NIDAQErrorHandler(iStatus, "DIG_Prt_Config",
     iIgnoreWarning);

    // Open all outputs
    iStatus =  DIG_Out_Prt (iDevice, iPort, 0xff);

    iRetVal = NIDAQErrorHandler(iStatus, "DIG_Out_Prt",
     iIgnoreWarning);

    // Set line
    iStatus = DIG_Out_Line (iDevice, iPort, iLine, iState);   
    iRetVal = NIDAQErrorHandler(iStatus, "DIG_Out_Line",iIgnoreWarning);
    if(iStatus = 1)
          printf(" The digital state of port %d line %d is set to %d\n", iPort, iLine, iState);
   
 
}

0 Kudos
Message 5 of 11
(4,610 Views)
toliks,

What is the physical behavior on the port (port 5) before, during, and after the code is executed? Does the code generate an error? How long does line 0 remain closed? Are you sure some external circuitry is not causing incorrect readings? Please let us know.

Message Edited by Voltage Viper [DE] on 01-30-2006 06:59 PM

Ryan Verret
Product Marketing Engineer
Signal Generators
National Instruments
0 Kudos
Message 6 of 11
(4,597 Views)

Hello

1. After PC startup all output lines in HIGH level (It's OK)

2. Due running of my application after  iStatus = DIG_Out_Line (iDevice, iPort, iLine, iState);  line state changes to LOW (as expected)

   To see this i stoped the programm by break point.

3.  After my application ends the logic state of the line returns to HIGH (this is my problem, i wont to remain the line in low state)

4. There are no errors while running

5. I think that when my application closes it release nidex32.lib and nidaq32.lib and they reset the card. May be there are another dll/lib that can do my job?

 

Thanks

0 Kudos
Message 7 of 11
(4,588 Views)
toliks,

I've run your eact code in VB6 with my MIO card and not observed the behavior you are seeing. What version of the Traditional (Legacy) NI-DAQ driver are you using? I'll see if I can find a 6527 around here to test it with your hardware.

Regards,
Ryan Verret
Product Marketing Engineer
Signal Generators
National Instruments
0 Kudos
Message 8 of 11
(4,570 Views)
Ryan,

I find solution for my problem by using NI-DAQmx instead traditional.

Some experiment that i did and it help me :

1. Opening Teset panel from Traditional devices
2. Setting some output line to low state
3. Checking that line is really in low state
4. Closing panel
5. Output line returns to high state
6. Opening Test panel from DAQmx devices
7. Setting some output line to low state
8. Checking that line is really in low state
9. Closing panel
10. The line remains in low state

May be its bug or some failure in my PC or 6527

Thanks for help
0 Kudos
Message 9 of 11
(4,564 Views)
toliks,

Glad to hear that you found a solution! I'll still try to reproduce the issue here, but you'll certainly be happier with the move to DAQmx. Just curious - what version of the Traditional NI-DAQ driver were you using? You can find this information in MAX under the "Software" tab.

Regards,
Ryan Verret
Product Marketing Engineer
Signal Generators
National Instruments
0 Kudos
Message 10 of 11
(4,560 Views)