PLC and CANBUS interface

Join Date
Dec 2019
Location
Vojvodina
Posts
3
Hello, I am fairly new to PLC programming and i have a problem connecting two devices. Mainly my problem is how to read data from the RFID which is connected to my PLC via CANopen field bus interface. I need to read the RFID tag from it and then open a garage door. It is done with serial communication in mind so basically i need to send correct information to RFID then RFID sends the value of the tag back. I know how to do serial communication between two ports on PLC but not through CANopen field bus so i am a little stuck. My question is how to make it work in Codesys? I am currently using Codesys v3.5.4, PLC CECC-S and my RFID is in the link bellow.

RFID:
https://docdro.id/KhNKbVf

https://docdro.id/4HabEHD

CECC-S

https://www.festo.com/net/SupportPortal/Files/573539/CECC-D_LK_S_2018-04b_8060506g1.pdf
 
Aleksandarm1116, hello!
Looking at your RFID device, it is not CANopen. Instead it uses ISO15693-3, which is some RFID specific protocol. It details quite clearly in your doc I think the strings to send and receive. As a side note, CANopen and ISO15693-3 both use CANbus, but so does DeviceNet.

I think instead of CANopen, you need to use the CAN Low Level Library.

This is given the cute name CL2, because it has two Ls.
Here is its documentation
https://help.codesys.com/webapp/idx-CAA_CanL2_Extern-lib;product=CAA_CanL2_Extern

Here is an example project.
https://store.codesys.com/can-bus-example.html

Good luck, I think it is perhaps not the easiest nor most rewarding challenge.
 
How do i create a message that i need to send it via CL2? I know there is a function called CreateMessage
CL2.CreateMessage(
hDriver := CAA.HANDLE,
cobID := CL2I.COBID,
usiLength := 2,
xRTR := FALSE,
x29bitID := FALSE,
peError := ADR(eError)

);
witch is called but i don't know how to use it to create a custom message that i need to send it to my RFID i need to send this string 0x1B, ‘R’, 0x01. And the return message that i get from RFID is stored in buffer.

Also there is a function which i don't quite understand
IF hMsg <> CAA.gc_hINVALID THEN
//Get message data pointer
pData := CL2.GetMessageDataPointer(hMessage := hMsg, peError := ADR(eError));
IF pData <> CAA.gc_pNULL THEN
//initialize message data
pData^[0] := 16#81;
pData^[1] := 16#0;
END_IF
it is initialising message data i have found it on codesys help site. Can someone explain it to me? Do i need that function in my code to handle the message data?
 
Last edited:

Similar Topics

Hello everyone! I have a Schneider M241 as master of a CAN network with several encoders and whatnot, everything is working fairly well. Now...
Replies
3
Views
1,708
I'm trying to set up a network of Sauer-Danfoss Plus +1 controllers (CANBUS), and I have to have numerous units very far apart from each other ( >...
Replies
2
Views
2,898
i have two plc 1. s7-1212dc/dc/dc ip; 192.168.0.1 2. s7-1500 1513-1pn ip; 192.168.3.2 i need to get data from plc1 to plc2. any idea how to do...
Replies
4
Views
31
Hello..I am new to Plc.I have Mitsubishi Melsec Fx3Ga-40MR PLC controlling a machine for packing powder.Currently the Plc has issue which power...
Replies
3
Views
121
Back
Top Bottom