The free LIN software API (Application Programming Interface) for Windows® (only for usage with the PCAN-USB Pro CAN/LIN interface)
-
sdelling
- Posts: 5
- Joined: Wed 14. Sep 2022, 11:39
Post
by sdelling » Mon 26. Sep 2022, 10:53
Hello,
I try to configure a Scheduling table for my PLin USB in C++ but cannot quite figure out what I am doing wrong:
Code: Select all
TLINScheduleSlot schedule[3];
schedule[0].Delay = 10;
schedule[0].FrameId[0] = 0x1E;
schedule[0].Type = sltUnconditional;
schedule[1].Delay = 20;
schedule[1].FrameId[0] = 0x20;
schedule[1].Type = sltUnconditional;
schedule[2].Delay = 10;
schedule[2].FrameId[0] = 0x20;
schedule[2].Type = sltUnconditional;
mApi.SetSchedule(mClientId, mHwId, 0, &schedule[0], 3);
mApi is an instance of the PLinApiClass.
Before I have done this:
Code: Select all
mApi.GetAvailableHardware(buf, sizeof(buf), &realCount);
mHwId = buf[0];
mApi.RegisterClient("HvLin", 0, &mClientId);
mApi.ConnectClient(mClientId, mHwId);
mApi.InitializeHardware(mClientId, mHwId, 2, 19200);
-
sdelling
- Posts: 5
- Joined: Wed 14. Sep 2022, 11:39
Post
by sdelling » Mon 26. Sep 2022, 13:32
I think I should register the frames before scheduling but the result is the same:
Code: Select all
TLINFrameEntry fe;
fe.ChecksumType = cstEnhanced;
fe.Direction = dirPublisher;
fe.FrameId = 0x1E;
fe.Length = 8;
BYTE data[8] = {0x00, 0x00, 0xF8, 0xF8, 0xFF, 0xFF, 0xFF, 0xFF};
std::memcpy(&fe.InitialData[0], &data[0], 8);
mApi.SetFrameEntry(mClientId, mHwId, &fe);
TLINFrameEntry fe2;
fe2.ChecksumType = cstEnhanced;
fe2.Direction = dirSubscriber;
fe2.FrameId = 0x20;
fe2.Length = 8;
mApi.SetFrameEntry(mClientId, mHwId, &fe2);
-
M.Riedl
- Software Development

- Posts: 34
- Joined: Wed 22. Sep 2010, 13:28
Post
by M.Riedl » Fri 7. Oct 2022, 13:36
Hello,
I think you forgot to initialize all struct values of the slots (TLINScheduleSlot).
You can just do it also like this:
Code: Select all
TLINScheduleSlot schedule[3] = { 0 };
Regards
M.Riedl
-
sdelling
- Posts: 5
- Joined: Wed 14. Sep 2022, 11:39
Post
by sdelling » Tue 11. Oct 2022, 10:19
Hello,
I already suspected that it was something stupid on my side

. Now it works.
Thanks!