Page 1 of 1

Troubles getting channels count using Peak.Can.Basic in C#

Posted: Mon 29. Jun 2020, 14:09
by hugues.ostermann
I have troubles getting the channel count using PCANBasic.GetValue method.
Return is always the following error -> TPCANStatus.PCAN_ERROR_ILLPARAMTYPE.
Sounds like I am not using the method properly.
However, I followed the sample code examples provided in documentation.
Any clue of what goes wrong here ?

Code: Select all

            uint iChannelsCount;
            TPCANStatus stsResult;
            // preinitialize
            stsResult = PCANBasic.GetValue(PCANBasic.PCAN_NONEBUS, TPCANParameter.PCAN_ATTACHED_CHANNELS_COUNT, out iChannelsCount, sizeof(uint));
Regards,

Re: Troubles getting channels count using Peak.Can.Basic in C#

Posted: Mon 29. Jun 2020, 14:15
by M.Heidemann
Hello,

Which version of PCANBasic are your currently using?

Best Regards

Marvin

Re: Troubles getting channels count using Peak.Can.Basic in C#

Posted: Mon 29. Jun 2020, 16:53
by hugues.ostermann
Hello,

Using API version 1.2.1.31

Regards,

Re: Troubles getting channels count using Peak.Can.Basic in C#

Posted: Tue 30. Jun 2020, 08:18
by M.Heidemann
Hello,

This parameter was introduced in version 4.4.0 of PCANBasic, make sure to switch to
the current version of the API -> https://www.peak-system.com/fileadmin/m ... -basic.zip

Here a link to the version history of PCANBasic:

https://www.peak-system.com/PCAN-Basic.126.0.html

This is also mentioned in the parameter documentation of PCANBasic:
ATTACHED_CHANNELS_COUNT.PNG
ATTACHED_CHANNELS_COUNT.PNG (102.39 KiB) Viewed 4390 times

Make sure to take a look at the new examples provided.


Best Regards

Marvin

Re: Troubles getting channels count using Peak.Can.Basic in C#

Posted: Wed 1. Jul 2020, 10:00
by hugues.ostermann
Hello,

Sorry, this is a common mistake.
Windows was using an older .dll than the one I expected.
Copying the version 4.4.0.288 in the root folder of my project solved the issue.

Many thanks for your help.
You can close the ticket.

Re: Troubles getting channels count using Peak.Can.Basic in C#

Posted: Wed 1. Jul 2020, 10:04
by M.Heidemann
Hello,

Thank you for your feedback!

Best Regards

Marvin

-Closed-