Jump to content
Mark-

"CAN" bus advice

Recommended Posts

Hello,

 

Anyone have suggestions for hardware/software for "Controller Area Network" (CAN) bus support for Windows using VCL?

 

Thanks,

 

Mark

 

 

Edited by Mark-

Share this post


Link to post
21 minutes ago, DelphiUdIT said:

You can start from here, they should have something for canbus (their hardware, PEAK CANBUS): https://www.peak-system.com/PCAN-Basic.239.0.html?&L=1&gclid=EAIaIQobChMIhOuR_8C6ggMVvJKDBx08TgQbEAAYASABEgLiAvD_BwE

1 minute ago, Uwe Raabe said:

It has been quite a while, but I had a good experience with CANUSB.

Thank you both.

Edited by Mark-

Share this post


Link to post

I'm using Peak System PCAN-USB interfaces with great success.

In their PCAN-BASIC API, they have a Lazarus folder which contains PCANBasic.pas files you can use with Delphi.

Those hardware and software are very reliable, I recommend it.

  • Thanks 1

Share this post


Link to post

We are too using Peak Systems hardware, but not with the free PCAN-Basic API (I tried it, but it was too much hassle), but the paid for PCAN-Developer 4 API. We use several PCAN USB interfaces per PC and many devices.The Delphi examples aren't that great though and there was at least one serious bug in one of them (I don't remember the specifics but it took me a while to figure it out. I reported the problem, so maybe they have fixed it by now.)

Edited by dummzeuch
  • Thanks 1

Share this post


Link to post
48 minutes ago, dummzeuch said:

not with the free PCAN-Basic API (I tried it, but it was too much hassle)

I use the PCAN-BASIC API with several PCAN-USB devices and there is no problem at all. Sorry but I don't agree with you : this API is easy to use whatever number of interfaces you use.

My use is controlling motors using digital positioning controllers in an industrial environment.

  • Thanks 1

Share this post


Link to post

I have never used their hardware directly, but I have worked on several systems where these were used (they used canbus motors to move the cameras) and I know that the basic APIs were used. The systems have always worked without any problems (I have made about a hundred).

  • Thanks 1

Share this post


Link to post
29 minutes ago, FPiette said:

I use the PCAN-BASIC API with several PCAN-USB devices and there is no problem at all. Sorry but I don't agree with you : this API is easy to use whatever number of interfaces you use.

My use is controlling motors using digital positioning controllers in an industrial environment.

I'm not saying it can't be done. Just more work than I was prepared to put into it. Some of the features seemed to be missing too. But that was several years ago (when PCAN Developer was still called CanAPI2 or something like this).

  • Thanks 1

Share this post


Link to post

I have used devices from Kvaser, IXXAT and some others. Kvaser has a superb support library (CANLib SDK) which includes Delphi interface module, their software model is very simple and elegant. IXXAT also used to have one, but I have not touched it since version 2.18 as the later versions of their VCI interface were incompatible with 2.x branch. Kvaser drivers implement virtual CAN channels which helps debugging when no real hardware is available.

Share this post


Link to post
On 11/11/2023 at 12:07 PM, Uwe Raabe said:

It has been quite a while, but I had a good experience with CANUSB.

I've bought the CANUSB dongle but they seem to only offer support for dot Net.
I've found an old project CanDe that uses an older version of the ComPortDriver but I can't get it to connect to the bus.

 

Do you remember what was required ?

Share this post


Link to post
45 minutes ago, fastbike said:

Do you remember what was required ?

It made use of canusbdrv.dll and a Delphi wrapper (see attachment). This was sometimes around 2008, so most likely that interface may have changed since then.

uCanUsbDll.pas

Share this post


Link to post
3 hours ago, fastbike said:

I've bought the CANUSB dongle but they seem to only offer support for dot Net.

A few years ago, I used with great success Peak Systems CANUsb interface. They  have a Delphi unit for it.

 

Share this post


Link to post
4 hours ago, FPiette said:

A few years ago, I used with great success Peak Systems CANUsb interface. They  have a Delphi unit for it.

 

Unfortunately out of my price range and I already have the other product.

Share this post


Link to post
Posted (edited)
7 hours ago, Uwe Raabe said:

It made use of canusbdrv.dll and a Delphi wrapper (see attachment). This was sometimes around 2008, so most likely that interface may have changed since then.

uCanUsbDll.pas

Thanks Uwe, I'll take a look later today.
I see they have a 64 bit DLL on the vendor website so I will update the pas import file to match.

Edited by fastbike

Share this post


Link to post
Posted (edited)
23 hours ago, fastbike said:

Thanks Uwe, I'll take a look later today.
I see they have a 64 bit DLL on the vendor website so I will update the pas import file to match.

Now that was useful, many thanks.

I spent about an hour getting my head around the whole 32 bit app running on a 64 bit OS, and unicode thing but after changing declarations using PChar to PAnsiChar and also figuring out that the safest way of calling some of the functions that were looking for a PChar to populate, was to declare an array of Byte and pass in the address - it all worked out ok.

The CANUSB driver installs the header files so you can check what is required but as far as I could tell the Delphi import unit had got everything correct.
I've created a simple monitor with some decoding of the Velbus protocol so I can figure out what is going on at the bus level.

Edited by fastbike

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×