Pigeon and the CODESYS – CAN bus

Pigeon and the CODESYS - CAN bus

This tutorial presents how to use Pigeon RB100/RB300 CAN bus in the CODESYS.

First modify the CODESYS configuration file /etc/CODESYScontrol_User.cfg:

[SysCom]
;Linux.Devicefile=/dev/ttyS

[CmpBlkDrvCom]
;Com.0.Name=MyCom
;Com.0.Baudrate=115200
;Com.0.Port=3
;Com.0.EnableAutoAddressing=1

[CmpSocketCanDrv]
ScriptPath=/opt/codesys/scripts/
ScriptName=rts_set_baud.sh

[SysProcess]
Command.0=shutdown

[CmpApp]
Bootproject.RetainMismatch.Init=1
Application.1=PIGEON_CANmaster

next add the bash script /opt/codesys/scripts/rts_set_baud.sh

#!/bin/sh
BITRATE=`expr $2 \\* 1000`
ifconfig $1 down
echo ip link set $1 type can bitrate $BITRATE
ip link set $1 type can bitrate $BITRATE
ifconfig $1 up

then modify the permissions:

sudo chmod +x /opt/codesys/scripts/rts_set_baud.sh

 

Back to Top