Brian C
2008-03-22 08:10:05 UTC
I hope everyone reading this has a good weekend!
The hardware... one National Instruments NI USB-8473 connected directly to an IBM G41 laptop.
The code...
#include <windows.h>#include <stdio.h>#include <nican.h>
int main(int argc, char* argv[]){ DWORD TickCountStart; DWORD TickCountStop; DWORD TickCountDelta; int i; char InterfaceName[256]; NCTYPE_ATTRID AttrIdList[8]; NCTYPE_UINT32 AttrValueList[8]; NCTYPE_STATUS Status; NCTYPE_OBJH NetIntfObjhRx; NCTYPE_UINT32 SerialNumber;
TickCountStart = GetTickCount();
for ( i=0; i <= 63; ++i ) { sprintf( InterfaceName, "CAN%d", i );
AttrIdList[0] = NC_ATTR_START_ON_OPEN; AttrValueList[0] = NC_FALSE;
Status = ncConfig( InterfaceName, 1, &AttrIdList[0], &AttrValueList[0] ); if ( Status >= 0 ) { Status = ncOpenObject( InterfaceName, &NetIntfObjhRx ); if ( Status >= 0 ) { ncGetAttribute( NetIntfObjhRx, NC_ATTR_HW_SERIAL_NUM, sizeof(SerialNumber), &SerialNumber ); ncCloseObject( NetIntfObjhRx ); } } } TickCountStop = GetTickCount(); TickCountDelta = TickCountStop - TickCountStart;
printf( "%f\n", TickCountDelta / 1000.0 );//getchar();
return 0;}
The first problem... This code typically takes 4.5 to 7.0 seconds long to run. For the application I'm developing, this is too long.
The second problem... If this code is run several times (usually about six), the 8473 "disappears". The LED remains on / orange. The 8473 does not show up in MAX nor does this code find it. The 8473 "returns" if it's removed and re-inserted.
The third problem... If this code is run twice (concurrently) it takes about 60 seconds to run.
The fourth problem... Occasionally, the NI-CAN dll faults when running this code. Note: nothing else is running and this code is all that's in the program.
If you have the time and an 8473, please confirm what I'm seeing.
Thank you,
Brian
The hardware... one National Instruments NI USB-8473 connected directly to an IBM G41 laptop.
The code...
#include <windows.h>#include <stdio.h>#include <nican.h>
int main(int argc, char* argv[]){ DWORD TickCountStart; DWORD TickCountStop; DWORD TickCountDelta; int i; char InterfaceName[256]; NCTYPE_ATTRID AttrIdList[8]; NCTYPE_UINT32 AttrValueList[8]; NCTYPE_STATUS Status; NCTYPE_OBJH NetIntfObjhRx; NCTYPE_UINT32 SerialNumber;
TickCountStart = GetTickCount();
for ( i=0; i <= 63; ++i ) { sprintf( InterfaceName, "CAN%d", i );
AttrIdList[0] = NC_ATTR_START_ON_OPEN; AttrValueList[0] = NC_FALSE;
Status = ncConfig( InterfaceName, 1, &AttrIdList[0], &AttrValueList[0] ); if ( Status >= 0 ) { Status = ncOpenObject( InterfaceName, &NetIntfObjhRx ); if ( Status >= 0 ) { ncGetAttribute( NetIntfObjhRx, NC_ATTR_HW_SERIAL_NUM, sizeof(SerialNumber), &SerialNumber ); ncCloseObject( NetIntfObjhRx ); } } } TickCountStop = GetTickCount(); TickCountDelta = TickCountStop - TickCountStart;
printf( "%f\n", TickCountDelta / 1000.0 );//getchar();
return 0;}
The first problem... This code typically takes 4.5 to 7.0 seconds long to run. For the application I'm developing, this is too long.
The second problem... If this code is run several times (usually about six), the 8473 "disappears". The LED remains on / orange. The 8473 does not show up in MAX nor does this code find it. The 8473 "returns" if it's removed and re-inserted.
The third problem... If this code is run twice (concurrently) it takes about 60 seconds to run.
The fourth problem... Occasionally, the NI-CAN dll faults when running this code. Note: nothing else is running and this code is all that's in the program.
If you have the time and an 8473, please confirm what I'm seeing.
Thank you,
Brian