Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

CAN 8513 Problem

NI - CAN model 8543 driver version 14.5 1、How to realize the timing sending function,The time to ask send frame 1 ms or 2 ms 2、How to use nxPropFrm_CANTxTime? Which function can be called it? 3、How to use nxPropFrm_CANTimingType? Which function can be called it? Best with examples of C language ,thanks
0 Kudos
Message 1 of 2
(3,059 Views)

It is possible to use NI-CAN board in Measurement Studio C# (C Sharp). However, it is not officially supported by National Instruments.

To call functions from ni-can.dll you need to create wrapper functions. For example to wrap the following NI-CAN function:

nctTypeStatus NCT_FUNC nctInitStart  (
             cstr ChannelList,
             i32 Interface,
             i32 Mode,
             f64 SampleRate,
             nctTypeTaskRef *TaskRef);

you need to create the following prototype in C# (C Sharp):

[DllImport("C:\\WINDOWS\\system32\\Nican.dll")]
public static unsafe extern int nctInitStart(string ChannelList, int Interface, int Mode, double SampleRate, int* TaskRef);

You need to use keyword unsafe in the prototype to be able to call external functions from dlls. Also, you cannot use char* type, instead you use string datatype. Also, to instead nctTypeTimestamp datatype use the following structure:

public struct CanTimestamp 
      {
        public int LowPart, HighPart;
      }

0 Kudos
Message 2 of 2
(2,996 Views)