11-20-2007 08:01 PM
11-27-2007 04:44 AM
01-14-2008 01:49 PM
I havent looked at the NI Frame API so here is some code for softing CANusb.dll.
Sorry this is old code in C++
In c# you would replace the pointer with an IntPnt and mark your code as unmaneaged (or is that unsafe)
The idear with this code was to to use a c# rapper around the C++ code as a stanalone assembly.
[DllImport("CANusb.dll")]
extern "C" int INIPC_initialize_board(canpc_ressources_s * rs);
[DllImport("CANusb.dll")]
extern "C" int CANPC_reset_board(void);
[DllImport("CANusb.dll")]
extern "C" int CANPC_reset_chip(void);
[DllImport("CANusb.dll")]
extern "C" int CANPC_initialize_chip(int nPrescaler,int nSyncJumpWidth,int nTimeSegment1,int nTimeSegment2,int nSampleMode);
Structures
#pragma pack(push,1)
[StructLayoutAttribute(LayoutKind::Sequential)]
__value struct canInitParams
{
unsigned long Ident;
int DataLength;
int RecOverrun_flag;
int RCV_fifo_lost_msg;
unsigned char RCV_data __nogc[8];
int AckOverrun_flag;
int XMT_ack_fifo_lost_acks;
int XMT_rmt_fifo_lost_remotes;
int Bus_state;
int Error_state;
int Can;
unsigned long Time;
};
#pragma pack(pop)
Colin
Delphi Diesel Systems