Hi,
I'm using a Pentium 4 with an NI4351 PCI DAC, freshly installed Win XP
Pro OS, LabWindows/CVI 7, and an updated NI435x driver. From inspection of debug output, the NI435X_Check_And_Read()
function appears to change the DAQ session variable, even though it never returns
an error. The typical debug window
output and subsequent code segment that generates it, follows:
Debug window o/p: // (with my comments)
----------------------------------------------------------------------------------
Session is 21776664 before read (on 04-10-2006 @ 09:43:13)
// (displayed because the static 'DAQ_Session' var is initially 0)
Session is 21776664 after read (on 04-10-2006 @ 09:43:13) // ditto
Session is 1057789952 after read (on 04-18-2006 @ 02:01:35) // invalid session value after 8 days continuous operation!
----------------------------------------------------------------------------------
Code snippet called from asynchronous timer:
----------------------------------------------------------------------------------
static TSV_DAQ_Session *DAQ_SessionPtr = 0, DAQsession = 0; // (global typedef variables)
if (event == EVENT_TIMER_TICK)
{
ViReal64 *DAQ_Data = GetPointerToDAQ_Data();
static int DAQ_err = NI435X_SUCCESS;
DAQ_SessionPtr = GetPointerToGlobal_TSV_DAQ_Session();
if (DAQsession != *DAQ_SessionPtr) DebugPrintf("Session
is %d before read (on %s @ %s)\n", *DAQ_SessionPtr, DateStr(),
TimeStr());
DAQ_err = NI435X_Check_And_Read
(*DAQ_SessionPtr, -1, &scans, DAQ_Data); // (no error
returned here)
if (DAQ_err != 0)
DebugPrintf("Error code %d on %s @ %s\n ", DAQ_err, DateStr(),
TimeStr()); // (never an error
here)
if (DAQsession != *DAQ_SessionPtr) DebugPrintf("Session
is %d after read (on %s @ %s)\n", *DAQ_SessionPtr, DateStr(),
TimeStr());
DAQsession = *DAQ_SessionPtr;
ReleasePointerToGlobal_TSV_DAQ_Session();
// other code
}
----------------------------------------------------------------------------------
All energy-saving and sleep facilities are disabled on PC.
After
occurance of invalid thread-safe session number, I get the following
error:
NON-FATAL RUN-TIME ERROR: "file1.c", line 109, col 1,
thread id 0x0000044C: Library function error (return value
== -14901 [0xffffc5cb]). Invalid handle.
The code at this line is: DefineThreadSafeVar (TSV_DAQ_Session, Global_TSV_DAQ_Session);
A fatal-run-time
error occurs after this because a subsequent call to
GetPointerToGlobal_TSV_DAQ_Session() of course returns a null pointer.
The crash occurs more frequently if I remove the DAQ-session checks.
Any ideas on what's happening and how it might be remedied would be
appreciated.
Many thanks,
John.