How to communicate via canbus

VISA; TCP/IP, CAN and similar protocols
Ответить
Bart
interested
interested
Сообщения: 8
Зарегистрирован: 05 июн 2008, 10:22
Контактная информация:

How to communicate via canbus

Сообщение Bart »

Hello,

In my project on work I have to communicate with a PLC(BK5200 from Berkhoff).
I will use a IXXAT-PC-104/PCI card with VCI3 driver.
All is installed but now.

I have an EDS file of the PLC but I don't know how to controll the Cancard with the EDS file in labview.

Can some one explain how to use EDS files with the VCI3 drivers from IXXAT?
Аватара пользователя
Eugen Graf

Activity Professionalism Silver Black
guru
guru
Сообщения: 6502
Зарегистрирован: 13 ноя 2007, 02:20
Награды: 4
Версия LabVIEW: 2009
Откуда: Saarbrücken
Контактная информация:

Re: How to communicate via canbus

Сообщение Eugen Graf »

IXXAT says to support LabVIEW. So you have to have a VI libraray which you can use to communicate over your CAN-card.
Where is the problem now?

Do you have this VI libraray?
Bart
interested
interested
Сообщения: 8
Зарегистрирован: 05 июн 2008, 10:22
Контактная информация:

Re: How to communicate via canbus

Сообщение Bart »

Hello,

Yes I have the VI lib for the CANcard, but I don't know how to use it with EDS file?

In the past I have worked with serial com which is very simple when sending commands.
I also used a DLL with property nodes and invoke nodes to controll, PC->UTP>CAN->electronic device.

But the "Electrinic Data Sheet" is very unknown to me how to use it.

I have included the EDS file may you want to see it.

Bart
Аватара пользователя
Eugen Graf

Activity Professionalism Silver Black
guru
guru
Сообщения: 6502
Зарегистрирован: 13 ноя 2007, 02:20
Награды: 4
Версия LabVIEW: 2009
Откуда: Saarbrücken
Контактная информация:

Re: How to communicate via canbus

Сообщение Eugen Graf »

EDS is a file where are descriptions of data packages.

If you get a data package (8 bytes) you have to convert this package into data. In the EDS file you can see HOW TO convert this raw 8 bytes to numbers for displying in your program.
Аватара пользователя
Eugen Graf

Activity Professionalism Silver Black
guru
guru
Сообщения: 6502
Зарегистрирован: 13 ноя 2007, 02:20
Награды: 4
Версия LabVIEW: 2009
Откуда: Saarbrücken
Контактная информация:

Re: How to communicate via canbus

Сообщение Eugen Graf »

But I think you can communicate with your device without using of EDS file.

You have to check the CAN protocoll description of your BK5200.

Than you have to initialize the CAN-card and start to read packages. If you get a package from device you have to parse it dependly from CAN protocoll description.

Why you want to use EDS file?

You need the EDS file almost only if you want to programm an universal CAN Monitor, it's not to easy.

But you want only to communicate with one device, so you can staticaly parse received data packages.
Bart
interested
interested
Сообщения: 8
Зарегистрирован: 05 июн 2008, 10:22
Контактная информация:

Re: How to communicate via canbus

Сообщение Bart »

Well protocol is a big word I think.
It's a devicenet system.
I downloaded the devicenet 1.6.1, but I still cannot see how to communicate with IXXAT.

I thought that when I init the ixxat can, then open the ixxat, and then send bytes or receave bytes.
And then I could see in the EDS file how the bytes are configured.
So I then know what each bytes stands for.

Now I have devicenet/can commands AND Ixxat/commands.
Which to use. where can I find examples, If I know the init procedure then I could make the rest.
Аватара пользователя
Eugen Graf

Activity Professionalism Silver Black
guru
guru
Сообщения: 6502
Зарегистрирован: 13 ноя 2007, 02:20
Награды: 4
Версия LabVIEW: 2009
Откуда: Saarbrücken
Контактная информация:

Re: How to communicate via canbus

Сообщение Eugen Graf »

If you read this documantation. You have as first to set the MAC ID from 0 to 63 with switchers on the devise.
Than you know wich CAN ID you have to parse.

Than you have to know what do you want to do. Do you want output or input analog or digital data.

Than if you look on the page 24, you will see which 3 bytes to send.

In the first two bytes is the value and in the 3rd byte you have to say which register and if you want to read or to write data from/to this register.
Bart
interested
interested
Сообщения: 8
Зарегистрирован: 05 июн 2008, 10:22
Контактная информация:

Re: How to communicate via canbus

Сообщение Bart »

I have ixxat and dnet vi's, which one must I use?
Do I have to see the CAN interface in Measurement & Automation Explorer?

I don't see how labview can set the CAN settings?
Or is the 'Interface Name' the link just like COM1 or COM3 ... in the 'Interface Name' I have the option of 'dnet0 - dnet31'.
Аватара пользователя
Eugen Graf

Activity Professionalism Silver Black
guru
guru
Сообщения: 6502
Зарегистрирован: 13 ноя 2007, 02:20
Награды: 4
Версия LabVIEW: 2009
Откуда: Saarbrücken
Контактная информация:

Re: How to communicate via canbus

Сообщение Eugen Graf »

I have ixxat and dnet vi's, which one must I use?
Do I have to see the CAN interface in Measurement & Automation Explorer?
I think you need both of VI libs.

No you will not see your CAN device in MAX, because MAX shows only NI CAN devices, not one from IXXAT.
I don't see how labview can set the CAN settings?
Or is the 'Interface Name' the link just like COM1 or COM3 ... in the 'Interface Name' I have the option of 'dnet0 - dnet31'.

You have to init your CAN device with IXXAT init VI, than init or select the right DNET channel, than buitl a CAN message using DNET vi and send this message with IXXAT send VI.
Bart
interested
interested
Сообщения: 8
Зарегистрирован: 05 июн 2008, 10:22
Контактная информация:

Re: How to communicate via canbus

Сообщение Bart »

I'm really confused.
Can you send me an example vi how to send data via the ixxat to the Dnet?

Bart
Аватара пользователя
Eugen Graf

Activity Professionalism Silver Black
guru
guru
Сообщения: 6502
Зарегистрирован: 13 ноя 2007, 02:20
Награды: 4
Версия LabVIEW: 2009
Откуда: Saarbrücken
Контактная информация:

Re: How to communicate via canbus

Сообщение Eugen Graf »

I have no VI libraries from IXXAT and from Dnet. I can`t show it. But you can give me download links.

But I woult prefer not to use Dnet. I can do it without, I think.

Can you show me how your VI looks? You can begin with CAN Initialisation. Than start a While Loop, where you read or write CAN messages. If While loop is stopped you should close the CAN interface.
Bart
interested
interested
Сообщения: 8
Зарегистрирован: 05 июн 2008, 10:22
Контактная информация:

Re: How to communicate via canbus

Сообщение Bart »

Why do say you can do without DNET?
The device is a DNET system.

The numbers of bytes vary depending how big the system is.
The master (PC)send:
2bytes per analoge output card
1byte per 4 digital outputs cards

The slave(bk5200) will send.
2bytes per analoge input card
1byte per 4 digital inputs cards
1byte containing the status.

It's for me no problem to unrafel the package once receaved i think.
But how does the slave know when to send the inputs+status?
Or does the slave sends the inputs+status contineous? meaning that the CAN buffer can get full so I have to scan very time for a new package.
I cannot see else what to send to the slave so that it will send the inputs+status bytes.
Bart
interested
interested
Сообщения: 8
Зарегистрирован: 05 июн 2008, 10:22
Контактная информация:

Re: How to communicate via canbus

Сообщение Bart »

Ok here is an example I wrote.
Вложения
canblock.JPG
canfront.JPG
Bart
interested
interested
Сообщения: 8
Зарегистрирован: 05 июн 2008, 10:22
Контактная информация:

Re: How to communicate via canbus

Сообщение Bart »

The people at beckhoff told me to use the OCX that gets available when installing the TwinCAT software.
Also examples are given when installing Beckhoff_Information_System.

Maybe this is an easier way, but I like to check what I get using "lower level can talk".
Аватара пользователя
Eugen Graf

Activity Professionalism Silver Black
guru
guru
Сообщения: 6502
Зарегистрирован: 13 ноя 2007, 02:20
Награды: 4
Версия LabVIEW: 2009
Откуда: Saarbrücken
Контактная информация:

Re: How to communicate via canbus

Сообщение Eugen Graf »

Hello Bart. Your VI looks good. If you will complete this VI with CAN-Write and Message-Parsing, than it should work. I would prefer this way. I don't know how difficult it's for you to take this way too.

OCX means ActiveX, I think. What is implemented in this OCX? I am almost sure, that IXXAT-CAN support isn't implemented there.

So I personally would stay on the Low-Level implementation. I mean the protocol is not very difficult if I read the documentation for Beckhoff.
Ответить

Вернуться в «Communcation with devices»