Quantcast
Channel: Digital I/O topics
Viewing all articles
Browse latest Browse all 2167

NI PCI 6509 not working under Win 7 at the same sample rate like under Win XP

$
0
0

Hello together,

before I come to the actual problem I want to tell you whats this about, we got an old testbench at which we test rotary encoders, in the testbench pc (win xp 32bit) we use the NI 6509 which reads the encoder state. In the test procedure we turn the encoder at a specified speed and verify that all gray values are read at the first turn, therefore we use the C API in an inhouse software. In the software we use the change detection to read the encoder values in the callback. That so far works perfectly.

The problem now is:
Since the old testbench is, well, quiet old, we decided to build a new one with a newer pc with Windows 7 64bit and the same NI 6509 card. The NI card works there too and reads the gray values but not at the specified speed of our gray encoder test (which works on the old win xp pc with the same card / specified speed -> all values read). If we make the same encoder test at the same speed on the win 7 pc it misses about 1/16 (about 1000) values. To eliminate our inhouse software as source of the problem I have written a small Qt programm that only access the NI card via the C API and logs the read values. With that test program I get exactly the same result, I get all values on the xp pc and alot misses on the win 7 one. With missing I mean that the gray values just dont get sampled. Its not always the same values that are missing, if we turned the encoder more than one turn for example we would get all values but thats not the goal.

So the question is, why does the same NI 6509 card that works under Win XP with a certain sample rate (encoder rotation speed) not work at the same speed under Win 7?

What I have tried so far without results:

-I have written a test program that only uses the used C API calls:

#defineSAMPLES_PER_CALL10000
#define
COUNT_GRAY_POSITIONS16384
void NidaqInterface::InitGrayConnection()
{
    qDebug() << "InitGrayConnection()";

    if (!DAQmxCreateTask("", &hTask))
    {
        qDebug() << "DAQmxCreateTask()";

        if (!DAQmxCreateDIChan(hTask, "Dev1/line0:13", "", DAQmx_Val_ChanForAllLines))
        {
            qDebug() << "DAQmxCreateDIChan()";

            int iStat1 = DAQmxCfgChangeDetectionTiming(hTask, "Dev1/line0:13", "Dev1/line0:13", DAQmx_Val_ContSamps, SAMPLES_PER_CALL);
            qDebug() << iStat1 << "DAQmxCfgChangeDetectionTiming()";

            int iStat2 = DAQmxRegisterSignalEvent(hTask, DAQmx_Val_ChangeDetectionEvent, 0, NidaqInterface::ChangeDetectionCallback, NULL);
            qDebug() << iStat2 << "DAQmxRegisterSignalEvent()";

            if (!DAQmxStartTask(hTask))
            {
                qDebug() << "DAQmxStartTask()";
            }

        }
    }

}

int32 CVICALLBACK NidaqInterface::ChangeDetectionCallback(TaskHandle hTask, int32 signalID, void *callbackData)
{
    uInt16 data[SAMPLES_PER_CALL];
    int32 read;


    if(!DAQmxReadDigitalU16(hTask, -1, 1.0, DAQmx_Val_GroupByChannel, data, SAMPLES_PER_CALL, &read, NULL))
    {
        for (int j = 0; j < read; j++)
        {
            uInt16 num = data[j] & (COUNT_GRAY_POSITIONS - 1);
            QString hexNum = QString("0x%1").arg(num, 4, 16, QLatin1Char( '0' ));

            testState[num] = 1;

            qDebug() << "Gray data[" << j << "]:" << hexNum << ";" << num;
        }
    }

    return 0;
}


-Installed 4 different driver versions, 17.5, 16.0, 8.6.1, 9.1
-Upgraded Win 7 with all available updates
-Changed the NI 6509 cards of the working Win XP pc with the Win 7 pc
-Tried different encoders

I am really at the end of my knowledge, in my opinion the problem has to be somewhere between the C API calls and the hardware, but I honestly don't know where exactly.

 

If anyone can give me some helpful ideas or new inspirations I'd be very grateful.

Thank you all,

Regards
Todd

 


Viewing all articles
Browse latest Browse all 2167

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>