Hi
I'm currently trying to interface with a Can bus driver dll. I have used the DLL succesfully with C# but I'm having a problem in Labview that I just can't catch. I've interfaced a number of the functions using the 'Call Library Function' Block' without a problem, but it all goes wrong for me when I try and input a Cluster to one of the functions i.e....
C#
// CAN message
[StructLayout(LayoutKind.Sequential, Pack = 1)]
public struct TPCANMsg
{
public uint ID; // 11/29 bit identifier
public byte MSGTYPE; // Bits from MSGTYPE_*
public byte LEN; // Data Length Code of the Msg (0..8)
[ MarshalAs( UnmanagedType.ByValArray, SizeConst = 8 )]
public byte[] DATA ; //Data 0 .. 7
}
///////////////////////////////////////////////////////////////////////////////
// Write()
// This function Place a CAN message into the Transmit Queue of the CAN Hardware
//
// Possible Errors: NOVXD RESOURCE BUSOFF QXMTFULL
//
[DllImport("PCAN_USB.dll", EntryPoint="CAN_Write")]
public static extern uint Write(ref TPCANMsg msg);
So In labView....
So I've created a Cluster with a U16(ID), U8 (MSGTYPE),U8(LEND) and an Array of 8 U8s (DATA), I then connect that to the DLL using a 'Call Library Function' block, it all runs ok except the Data part on the Can bus doesn't seem to be getting passed correctly and is doesn't change. The Help says a cluster will get passed as a referance so that looks right. I have my 'Call Library Function' configured to handle the cluster as 'Adapt to Type' and 'Handles by Value'.
Any help on this would be appreciated.
Derek