Code: Select all
byte hClient = 0;
PLinApi.RegisterClient("LINQPad", 1, ref hClient);
PLinApi.ConnectClient(hClient, 1);
PLinApi.InitializeHardware(hClient, 1, TLINHardwareMode.modMaster, 16920);
PLinApi.SetClientFilter(hClient, 1, 0xffffffffffffffff);
var sendMsg = new TLINMsg
{
FrameId = 0x3C,
Data = new byte[8],
Length = 8,
ChecksumType = TLINChecksumType.cstClassic,
Direction = TLINDirection.dirPublisher
};
PLinApi.CalculateChecksum(ref sendMsg);
PLinApi.Write(hClient, 1, ref sendMsg);
var recvMsg = new TLINMsg
{
FrameId = 0x3D,
Data = new byte[8],
Length = 8,
ChecksumType = TLINChecksumType.cstAuto,
Direction = TLINDirection.dirSubscriberAutoLength
};
PLinApi.GetPID(ref recvMsg.FrameId);
PLinApi.CalculateChecksum(ref recvMsg);
PLinApi.Write(hClient, 1, ref recvMsg);
Thread.Sleep(1000);
var received = new TLINRcvMsg();
Console.Out.WriteLine(PLinApi.Read(hClient, ref received));
Console.Out.WriteLine($"{received.FrameId}: {String.Join(' ', received.Data.Select(b => b.ToString("X")))}");
I based my code on the example provided in this thread, but without any luck. PLinApi is in a different (VB.net) project, unmodified from the example provided in the PLINApi.dll download.
My LIN Hardware should be good, since the DUT physically responds to a different message (which expects no LIN response) correctly.
Any help would be appreciated.