You are on page 1of 14

C:\Users\janakg\Desktop\ABB Sample Code\BalluffIOLinkRAPID_Parameterising.

mod Wednesday, 6 July 2016 11:26 AM


MODULE Module1
!DISCLAIMER!!
!Unless required by applicable law or agreed to in writing, software distributed under the
License is distributed on an
!"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
!THIS RAPID CODE IS INTENDED TO BE USED PURELY AS A REFERENCE. THE FOLLOWING CODE DOES NOT
REPLACE INSTRUCTIONS AND WARNINGS PROVIDED IN DATASHEETS AND MANUALS OF THE RELEVANT PRODUCTS.

!*********************************************************************!
!Date 29th June 2016
!Company: BALLUFF Pty Ltd, Australia
!www.balluff.com.au
!Code written by Janak S Gorana
!
!**************Code Details*******************************************!
!This RAPID code is designed to work with ABB Devicenet enabled IRC5 controller and
Balluff Devicenet IO Link Master (BNI005A)
!The Robot controller works as Devicenet Master and the Balluff BNI005A works as a
Devicenet Slave.
!The main routine uses subroutines to parameterise the Master module and connected IO
Link devices.
!
!**************BNI005A Setup******************************************!
!BNI005A must be setup as a Devicenet Device with following parameters:
! (To add a new Devicenet Device, Go to "Configuration - I/O System > Devicenet Device >
Right click and Add new Devicenet Device)
! * Name : BNI005A
! * Connected to Industrial Network : Devicenet
! * State when system startup : Activated
! * Trust LeveL : Internal Device Trust Level
! * Simulated : No
! * Vendor Name : Balluff
! * Product Name : BNI DNT-502-100-Z001
! * Recovery Time : 5000ms
! * Identification Label : DeviceNet Generic Device
! * Address : 21 (To be set using the soft keys on the module)
! * Vendor ID : 43
! * Product Code : 502
! * Device Type : 12
! * Production Inhibit Time (ms) : 10
! * Connection Type : Change of State (COS)
! * Poll Rate : 1000
! * Quick connect : Deactivated (Can be activated later - follow the Balluff BNI005A
manual for enabling "Quick Connect" command followed by "Settings Done" command.
! After these two commands are executed, do a power cycle on the BNI005A and
change this configuration from "Deactivated" to "Activated"
! ****IMPORTANT!!!!**
! On a New BNI005A module, all of 8 ports are set as "Standard I/O". Hence the Output
size is 6 bytes and input size is 8 bytes.
! Once the bottom 4 ports are set as "IO Link", the byte size will change. When
"Master_Parameterising()" subroutine is implemented, bottom 4 ports become IO Link ports
with 8in/out. This makes the total byte size of Master 38 out and 40 in (That is,
6+(4x8) bytes for output and 8+(4x8) bytes for input).
! Most of the ABB Robots cannot handle more than 64 bytes in and 64 bytes in total.
! If you do not use the Master_Parameterising() subroutine and wish to use your own
fieldbus commands to parameterise the Master, you must be VERY CAREFUL in not enabling
all of the bottom 4 IO Link ports without configuring the port sizes as this WILL exceed
the Robot limitation!
! This cannot be undone without using an external PLC (like Allen Bradley Devicenet
PLC with RSNetworx) - Follow the Balluff BNI005A manual in case you have enabled the IO
Link Ports without setting the Port sizes.
! When you receive a fresh BNI005A from factory, set the out and input sizes as
following:
! * Connection Output Size : 6
! * Connection Input size : 8
! In this example, Master_Parameterising() subroutine will enable all four Ports as IO
Link (bottom four ports) with byte size 8in/out.
! New Input and output sizes of the Master must be updated under Devicenet Device
properties
! * Connection Output size : 38
! * Connection Input size : 40
-1-
C:\Users\janakg\Desktop\ABB Sample Code\BalluffIOLinkRAPID_Parameterising.mod Wednesday, 6 July 2016 11:26 AM
! You will need to do a Warm Restart after you have changed any of the above Devicenet
configuration for BNI005A - most probably you will be prompted by the RobotStudio
!
!
!**************Parameterising BNI005A Master*****************************!
!Master parameters are in instance (also known as Class ID) 0x64. Complete list of
Master parameters are listed in the BNI005A manual.
!In this example, we will be looking at parameterising the Master to configure all four
IO Link Port's Byte size and enabling them to be an IO Link Port.
!On BNI005A module, top 4 ports can only be used as Standard I/O port. Bottom 4 ports
can be used as IO Link or Standard IO Ports.
!Once the parameters of the Master module are changed through RAPID, the unit will
automatically restart.
!Please be aware, if the new parameters affect the input and output size of the whole
module, the new byte sizes must be set in Module configuration (Under Devicenet Devices
settings)
!This example does change the input and output byte size.
!If you do not wish to use Master_Parameterising() Subroutine, you may use Devicenet
commands to do the same function.
!Sequence to follow to parameterise the Master using Devicenet Commands:
! 1- Establish the connection to the BNI005A master using its current byte size (fresh
units have 8 in and 6 out)
! 2- Send "Port Mode" Explicit message for each IO Link Port that needs to be configured
! 3- Send "IOL Port Enable" Explicit message - To enable some or all of the IO Link
ports
! 4- Send "Settings Done" Explicit message
! 5- Power cycle the Master
! 6- Configure the Master under "Devicenet Devices" to update the input and output
byte sizes
! 7- Warm Restart the Robot controller
!

!**************Parameterising IO Link Devices***************************!


!Parameters of the IO Link Devices can be set by sending explicit messages through
instance (or Class) 0x66.
!BNI005A Manual lists the commands that can be sent.
!In this example, Balluff's 5 Segment Smartlight (BNI0083) connected on first IO Link
port will be parameterised. The mode of the Smartlight will be changed from "Segment
Mode" to "Runlight Mode".
!The complete list of parameters is given in the BNI0083 Manual.
!P1IOLDevice_Parameterising() Subroutine can be used to change the paramers of the
Smartlight. If you do not wish to use this subroutine, you may use Devicenet commands to
do the same function.
!Sequence to follow to parameterise the IO Link Deivces using Devicenet commands:
! 1- Send "Send Request" Explicit message for Port 1 IO Link - To set BOOL value 0.
! 2- Send "Action" - To specify Read or Write
! 3- Send "Index" (Refer IO Link Device Manual) - For Smartlight, Mode is on Index 0x40.
! 4- Send "SubIndex" (Refer IO Link Device Manual) - Here, SubIndex is 0x00.
! 5- Send "Data Length" (Refer IO Link Device Manual) - Here, 0x01.
! 6- Send "Data" (Refer IO Link Device Manual) - Here, 0x00 for Segment Mode. 0x02 for
Runlight Mode.
! 7- Send "Send Request" again. This time to set BOOL value 1.
!***************END OF INSTRUCTIONS***************************************!
!**********Declaration of Variables for Explicit messaging*********!
!
!Variable name for Device
VAR iodev Master1;
!
!String to Store Read and Unpacked Values
VAR string answer;
VAR rawbytes RBRead;
!
!Explicit message attribute to "Set" values
CONST string SetAttr:="10";
!Explicit message attribute to "Get" values
CONST string GetAttr:="0E";
!
!Master Device Name
VAR string DeviceName;
!***********END OF DECLARATION OF VARIABLES FOR EXPLICIT MESSAGING**!

-2-
C:\Users\janakg\Desktop\ABB Sample Code\BalluffIOLinkRAPID_Parameterising.mod Wednesday, 6 July 2016 11:26 AM
PROC main()
DeviceName:="BNI005A_New";
!CAUTION: Executing the "Master_Parameterising" Sub routine may change the Device
I/O size.
!Master_Parameterising;
!P1IOLDevice_Parameterising;
!P2IOLDevice_Parameterising;
!P3IOLDevice_Parameterising;
!P4IOLDevice_Parameterising;
ENDPROC

PROC Master_Parameterising()
!This Sub routine will enable all 4 IO Link Ports and set the byte size of 8in/8out
for each IO Link Port
!
!***************Master Parameters - Explicit
paths*****************************************!
!NOTE: Explicit message paths, Data types and Value range can be found in the EDS
file of BNI005A
!
!Path for "Port Mode" Explicit message to set the input and output byte size of the
IO Link Port 1
! - Class is 65, Instance for IO Link Port 1 is 01, Attribute ID is 04, Data Type
is C6, Data Length is 01
CONST string Path_PortModeP1:="6,20 65 24 01 30 04, C6, 01";
!
!Path for "Port Mode" Explicit message to set the input and output byte size of the
IO Link Port 2
! - Class is 65, Instance for IO Link Port 2 is 02, Attribute ID is 04, Data Type
is C6, Data Length is 01
CONST string Path_PortModeP2:="6,20 65 24 02 30 04, C6, 01";
!
!Path for "Port Mode" Explicit message to set the input and output byte size of the
IO Link Port 3
! - Class is 65, Instance for IO Link Port 3 is 03, Attribute ID is 04, Data Type
is C6, Data Length is 01
CONST string Path_PortModeP3:="6,20 65 24 03 30 04, C6, 01";
!
!Path for "Port Mode" Explicit message to set the input and output byte size of the
IO Link Port 4
! - Class is 65, Instance for IO Link Port 4 is 04, Attribute ID is 04, Data Type
is C6, Data Length is 01
CONST string Path_PortModeP4:="6,20 65 24 04 30 04, C6, 01";
!
!Path for "IOL Port Enable" Explicit message
! - Class is 64, Instance is 00, Attribute ID is 07, Data Type is D1, Data Length
is 01
CONST string Path_IOLPortEnable:="6,20 64 24 00 30 07,D1,01";
!
!Path for "IOL Port Enable" Explicit message
! - Class is 64, Instance is 00, Attribute ID is 08, Data Type is C1, Data Length
is 01
CONST string Path_SettingsDone:="6,20 64 24 00 30 08,C1,01";
!
!Variables for Parameterisation of Master BNI005A
VAR rawbytes RBSettingsDone_Reset;
VAR byte SettingsDone_Reset;
VAR rawbytes RBPortModeP1;
VAR byte PortModeP1;
VAR rawbytes RBPortModeP2;
VAR byte PortModeP2;
VAR rawbytes RBPortModeP3;
VAR byte PortModeP3;
VAR rawbytes RBPortModeP4;
VAR byte PortModeP4;
VAR rawbytes RBIOLPortEnable;
VAR byte IOLPortEnable;
VAR rawbytes RBSettingsDone_Set;
VAR byte SettingsDone_Set;
SettingsDone_Reset:=StrToByte("00"\Hex);
-3-
C:\Users\janakg\Desktop\ABB Sample Code\BalluffIOLinkRAPID_Parameterising.mod Wednesday, 6 July 2016 11:26 AM
!8in/8out bytes for All four IO Link Ports
PortModeP1:=StrToByte("1F"\Hex);
PortModeP2:=StrToByte("1F"\Hex);
PortModeP3:=StrToByte("1F"\Hex);
PortModeP4:=StrToByte("1F"\Hex);
!Enabling all Ports to be IO Link (00 = All Disabled. OF = All Enabled)
IOLPortEnable:=StrToByte("0F"\Hex);
SettingsDone_Set:=StrToByte("01"\Hex);
!
!Settings Done Reset Implementation
ClearRawBytes RBSettingsDone_Reset;
PackDNHeader SetAttr,Path_SettingsDone,RBSettingsDone_Reset;
!Pack the path in header (That is first byte of the Raw container)
PackRawBytes
SettingsDone_Reset,RBSettingsDone_Reset,(RawBytesLen(RBSettingsDone_Reset)+1)\Hex1;
!Pack the Data in next byte
!
!PortMode1 Implementation for Setting byte size of Port 1 IO Link
ClearRawBytes RBPortModeP1;
PackDNHeader SetAttr,Path_PortModeP1,RBPortModeP1;
!Pack the path in header (First byte of the RAW container)
PackRawBytes PortModeP1,RBPortModeP1,(RawBytesLen(RBPortModeP1)+1)\Hex1;
!Pack the Data in next byte
!
!PortMode2 Implementation for Setting byte size of Port 2 IO Link
ClearRawBytes RBPortModeP2;
PackDNHeader SetAttr,Path_PortModeP2,RBPortModeP2;
!Pack the path in header (First byte of the RAW container)
PackRawBytes PortModeP2,RBPortModeP2,(RawBytesLen(RBPortModeP2)+1)\Hex1;
!Pack the Data in next byte
!
!PortMode3 Implementation for Setting byte size of Port 3 IO Link
ClearRawBytes RBPortModeP3;
PackDNHeader SetAttr,Path_PortModeP3,RBPortModeP3;
!Pack the path in header (First byte of the RAW container)
PackRawBytes PortModeP3,RBPortModeP3,(RawBytesLen(RBPortModeP3)+1)\Hex1;
!Pack the Data in next byte
!
!PortMode4 Implementation for Setting byte size of Port 4 IO Link
ClearRawBytes RBPortModeP4;
PackDNHeader SetAttr,Path_PortModeP4,RBPortModeP4;
!Pack the path in header (First byte of the RAW container)
PackRawBytes PortModeP4,RBPortModeP4,(RawBytesLen(RBPortModeP4)+1)\Hex1;
!Pack the Data in next byte
!
!IOL Mode Implementation
ClearRawBytes RBIOLPortEnable;
PackDNHeader SetAttr,Path_IOLPortEnable,RBIOLPortEnable;
!Pack the path in header (First byte of the RAW container)
PackRawBytes IOLPortEnable,RBIOLPortEnable,(RawBytesLen(RBIOLPortEnable)+1)\Hex1;
!Pack the Data in next byte
!
!Settings Done Set Implementation
ClearRawBytes RBSettingsDone_Set;
PackDNHeader SetAttr,Path_SettingsDone,RBSettingsDone_Set;
!Pack the path in header (First byte of the RAW container)
PackRawBytes
SettingsDone_Set,RBSettingsDone_Set,(RawBytesLen(RBSettingsDone_Set)+1)\Hex1;
!Pack the Data in next byte
!
!Open the Device, Write the data and close the device
Open "/FCI1:"\File:=DeviceName,Master1\Bin;
WriteRawBytes
Master1,RBSettingsDone_Reset\NoOfBytes:=RawBytesLen(RBSettingsDone_Reset);
WaitTime 0.1;
WriteRawBytes Master1,RBPortModeP1\NoOfBytes:=RawBytesLen(RBPortModeP1);
WaitTime 0.1;
WriteRawBytes Master1,RBPortModeP2\NoOfBytes:=RawBytesLen(RBPortModeP2);
WaitTime 0.1;
WriteRawBytes Master1,RBPortModeP3\NoOfBytes:=RawBytesLen(RBPortModeP3);
WaitTime 0.1;
-4-
C:\Users\janakg\Desktop\ABB Sample Code\BalluffIOLinkRAPID_Parameterising.mod Wednesday, 6 July 2016 11:26 AM
WriteRawBytes Master1,RBPortModeP4\NoOfBytes:=RawBytesLen(RBPortModeP4);
WaitTime 0.1;
WriteRawBytes Master1,RBIOLPortEnable\NoOfBytes:=RawBytesLen(RBIOLPortEnable);
WaitTime 0.1;
WriteRawBytes Master1,RBSettingsDone_Set\NoOfBytes:=RawBytesLen(RBSettingsDone_Set);
WaitTime 0.1;
Close Master1;
ENDPROC
PROC P1IOLDevice_Parameterising()
!This Sub routine will enable write the parameter on the IOL Device connected on P1
!
!***************IOL Port 1 Parameters*****************************************!
!NOTE: Explicit message paths, Data types and Value range can be found in the EDS
file of BNI005A
!NOTE: Parameter Values, Index and SubIndex values can be found in IO Link Device
manual
!
!Path for "Action" Explicit message to set the Read or Write command of the IO Link
Port 1
! - Class is 67, Instance for IO Link Port 1 is 01, Attribute ID is 06, Data Type
is C6, Data Length is 01
CONST string Path_ActionP1:="6,20 66 24 01 30 06,C6,01";
!
!Path for "Index" Explicit message to set Index of the IO Link Port 1
! - Class is 67, Instance for IO Link Port 1 is 01, Attribute ID is 07, Data Type
is C7, Data Length is 02
CONST string Path_IndexP1:="6,20 66 24 01 30 07,C7,02";
!
!Path for "SubIndex" Explicit message to set Index of the IO Link Port 1
! - Class is 67, Instance for IO Link Port 1 is 01, Attribute ID is 08, Data Type
is C6, Data Length is 01
CONST string Path_SubIndexP1:="6,20 66 24 01 30 08,C6,01";
!
!Path for "Data Length" Explicit message to set Index of the IO Link Port 1
! - Class is 67, Instance for IO Link Port 1 is 01, Attribute ID is 09, Data Type
is C6, Data Length is 01
CONST string Path_DataLengthP1:="6,20 66 24 01 30 09,C6,01";
!
!Path for "Data" Explicit message to set Index of the IO Link Port 1
! - Class is 67, Instance for IO Link Port 1 is 01, Attribute ID is 0A, Data Type
is DA, Data Length is 01
CONST string Path_DataP1:="6,20 66 24 01 30 0A,C2,232";
!
!Path for "Send Request" Explicit message to set Index of the IO Link Port 1
! - Class is 67, Instance for IO Link Port 1 is 01, Attribute ID is 0B, Data Type
is C1, Data Length is 01
CONST string Path_SendRequestP1:="6,20 66 24 01 30 0B, C1, 01";
!Variables for Port 1 IO Link Device Parameterisation
VAR rawbytes RBSendRequestP1;
VAR byte SendRequestP1_Reset;
VAR byte SendRequestP1_Set;
VAR rawbytes RBActionP1;
VAR byte ActionP1;
VAR rawbytes RBIndexP1;
VAR byte IndexLowByteP1;
VAR byte IndexHighByteP1;
VAR rawbytes RBSubIndexP1;
VAR byte SubIndexP1;
VAR rawbytes RBDataLengthP1;
VAR byte DataLengthP1;
VAR rawbytes RBDataP1;
VAR byte DataP1;
SendRequestP1_Reset:=StrToByte("00"\Hex);
!Action 02 is for Write, 03 is for Read
ActionP1:=StrToByte("02"\Hex);
!Index (Usually only LOW byte needs to be executed
IndexLowByteP1:=StrToByte("40"\Hex);
IndexHighByteP1:=StrToByte("00"\Hex);
!SubIndex
SubIndexP1:=StrToByte("00"\Hex);
!Data Length
-5-
C:\Users\janakg\Desktop\ABB Sample Code\BalluffIOLinkRAPID_Parameterising.mod Wednesday, 6 July 2016 11:26 AM
DataLengthP1:=StrToByte("01"\Hex);
!Data /Range
DataP1:=StrToByte("02"\Hex);
SendRequestP1_Set:=StrToByte("01"\Hex);
!
!Send Request Reset Implementation
ClearRawBytes RBSendRequestP1;
ClearRawBytes RBRead;
!Pack the path in header (That is first byte of the Raw container)
PackDNHeader SetAttr,Path_SendRequestP1,RBSendRequestP1;
!Pack the Data in next byte
PackRawBytes
SendRequestP1_Reset,RBSendRequestP1,(RawBytesLen(RBSendRequestP1)+1)\Hex1;
Open "/FCI1:"\File:=DeviceName,Master1\Bin;
WriteRawBytes Master1,RBSendRequestP1\NoOfBytes:=RawBytesLen(RBSendRequestP1);
!ReadRawBytes Master1,RBRead\Time:=1;
Close Master1;
!UnpackRawBytes RBRead,1,answer\ASCII:=10;
!
! !Action Implementation
ClearRawBytes RBActionP1;
ClearRawBytes RBRead;
PackDNHeader SetAttr,Path_ActionP1,RBActionP1;
!Pack the path in header (That is first byte of the Raw container)
PackRawBytes ActionP1,RBActionP1,(RawBytesLen(RBActionP1)+1)\Hex1;
!Pack the Data in next byte
Open "/FCI1:"\File:=DeviceName,Master1\Bin;
WriteRawBytes Master1,RBActionP1\NoOfBytes:=RawBytesLen(RBActionP1);
!ReadRawBytes Master1,RBRead\Time:=1;
Close Master1;
!UnpackRawBytes RBRead,1,answer\ASCII:=10;
! !
! !Index Implementation
ClearRawBytes RBIndexP1;
ClearRawBytes RBRead;
PackDNHeader SetAttr,Path_IndexP1,RBIndexP1;
!Pack the path in header (That is first byte of the Raw container)
PackRawBytes IndexLowByteP1,RBIndexP1,(RawBytesLen(RBIndexP1)+1)\Hex1;
PackRawBytes IndexHighByteP1,RBIndexP1,(RawBytesLen(RBIndexP1)+1)\Hex1;
!Pack the Data in next byte
Open "/FCI1:"\File:=DeviceName,Master1\Bin;
WriteRawBytes Master1,RBIndexP1\NoOfBytes:=RawBytesLen(RBIndexP1);
!ReadRawBytes Master1,RBRead\Time:=1;
Close Master1;
!UnpackRawBytes RBRead,1,answer\ASCII:=10;
! !
! !SubIndex Implementation
ClearRawBytes RBSubIndexP1;
ClearRawBytes RBRead;
PackDNHeader SetAttr,Path_SubIndexP1,RBSubIndexP1;
!Pack the path in header (That is first byte of the Raw container)
PackRawBytes SubIndexP1,RBSubIndexP1,(RawBytesLen(RBSubIndexP1)+1)\Hex1;
!Pack the Data in next byte
Open "/FCI1:"\File:=DeviceName,Master1\Bin;
WriteRawBytes Master1,RBSubIndexP1\NoOfBytes:=RawBytesLen(RBSubIndexP1);
!ReadRawBytes Master1,RBRead\Time:=1;
Close Master1;
!UnpackRawBytes RBRead,1,answer\ASCII:=10;
! !
! !Data Length Implementation
ClearRawBytes RBDataLengthP1;
ClearRawBytes RBRead;
PackDNHeader SetAttr,Path_DataLengthP1,RBDataLengthP1;
!Pack the path in header (That is first byte of the Raw container)
PackRawBytes DataLengthP1,RBDataLengthP1,(RawBytesLen(RBDataLengthP1)+1)\Hex1;
!Pack the Data in next byte
Open "/FCI1:"\File:=DeviceName,Master1\Bin;
WriteRawBytes Master1,RBDataLengthP1\NoOfBytes:=RawBytesLen(RBDataLengthP1);
!ReadRawBytes Master1,RBRead\Time:=1;
Close Master1;
!UnpackRawBytes RBRead,1,answer\ASCII:=10;
-6-
C:\Users\janakg\Desktop\ABB Sample Code\BalluffIOLinkRAPID_Parameterising.mod Wednesday, 6 July 2016 11:26 AM
! !
! !Data Implementation
ClearRawBytes RBDataP1;
ClearRawBytes RBRead;
PackDNHeader SetAttr,Path_DataP1,RBDataP1;
!Pack the path in header (That is first byte of the Raw container)
PackRawBytes DataP1,RBDataP1,(RawBytesLen(RBDataP1)+1)\Hex1;
!Pack the Data in next byte
Open "/FCI1:"\File:=DeviceName,Master1\Bin;
WriteRawBytes Master1,RBDataP1\NoOfBytes:=RawBytesLen(RBDataP1);
!ReadRawBytes Master1,RBRead\Time:=1;
Close Master1;
!UnpackRawBytes RBRead,1,answer\ASCII:=10;
! !
! !Send Request Set Implementation
ClearRawBytes RBSendRequestP1;
ClearRawBytes RBRead;
PackDNHeader SetAttr,Path_SendRequestP1,RBSendRequestP1;
!Pack the path in header (That is first byte of the Raw container)
PackRawBytes SendRequestP1_Set,RBSendRequestP1,(RawBytesLen(RBSendRequestP1)+1)\Hex1;
!Pack the Data in next byte
Open "/FCI1:"\File:=DeviceName,Master1\Bin;
WriteRawBytes Master1,RBSendRequestP1\NoOfBytes:=RawBytesLen(RBSendRequestP1);
!ReadRawBytes Master1,RBRead\Time:=1;
Close Master1;
!UnpackRawBytes RBRead,1,answer\ASCII:=10;
ENDPROC
PROC P2IOLDevice_Parameterising()
!This Sub routine will enable write the parameter on the IOL Device connected on P2
!
!***************IOL Port 2 Parameters*****************************************!
!NOTE: Explicit message paths, Data types and Value range can be found in the EDS
file of BNI005A
!NOTE: Parameter Values, Index and SubIndex values can be found in IO Link Device
manual
!
!Path for "Action" Explicit message to set the Read or Write command of the IO Link
Port 2
! - Class is 67, Instance for IO Link Port 2 is 02, Attribute ID is 06, Data Type
is C6, Data Length is 01
CONST string Path_ActionP2:="6,20 66 24 02 30 06,C6,01";
!
!Path for "Index" Explicit message to set Index of the IO Link Port 2
! - Class is 67, Instance for IO Link Port 2 is 01, Attribute ID is 07, Data Type
is C7, Data Length is 02
CONST string Path_IndexP2:="6,20 66 24 02 30 07,C7,02";
!
!Path for "SubIndex" Explicit message to set Index of the IO Link Port 2
! - Class is 67, Instance for IO Link Port 2 is 01, Attribute ID is 08, Data Type
is C6, Data Length is 01
CONST string Path_SubIndexP2:="6,20 66 24 02 30 08,C6,01";
!
!Path for "Data Length" Explicit message to set Index of the IO Link Port 2
! - Class is 67, Instance for IO Link Port 2 is 01, Attribute ID is 09, Data Type
is C6, Data Length is 01
CONST string Path_DataLengthP2:="6,20 66 24 02 30 09,C6,01";
!
!Path for "Data" Explicit message to set Index of the IO Link Port 2
! - Class is 67, Instance for IO Link Port 2 is 01, Attribute ID is 0A, Data Type
is DA, Data Length is 01
CONST string Path_DataP2:="6,20 66 24 02 30 0A,C2,232";
!
!Path for "Send Request" Explicit message to set Index of the IO Link Port 2
! - Class is 67, Instance for IO Link Port 2 is 02, Attribute ID is 0B, Data Type
is C1, Data Length is 01
CONST string Path_SendRequestP2:="6,20 66 24 02 30 0B, C1, 01";
!Variables for Port 2 IO Link Device Parameterisation
VAR rawbytes RBSendRequestP2;
VAR byte SendRequestP2_Reset;
VAR byte SendRequestP2_Set;
VAR rawbytes RBActionP2;
-7-
C:\Users\janakg\Desktop\ABB Sample Code\BalluffIOLinkRAPID_Parameterising.mod Wednesday, 6 July 2016 11:26 AM
VAR byte ActionP2;
VAR rawbytes RBIndexP2;
VAR byte IndexLowByteP2;
VAR byte IndexHighByteP2;
VAR rawbytes RBSubIndexP2;
VAR byte SubIndexP2;
VAR rawbytes RBDataLengthP2;
VAR byte DataLengthP2;
VAR rawbytes RBDataP2;
VAR byte DataP2;
SendRequestP2_Reset:=StrToByte("00"\Hex);
!Action 02 is for Write, 03 is for Read
ActionP2:=StrToByte("02"\Hex);
!Index (Usually only LOW byte needs to be updated)
IndexLowByteP2:=StrToByte("40"\Hex);
IndexHighByteP2:=StrToByte("00"\Hex);
!SubIndex
SubIndexP2:=StrToByte("00"\Hex);
!Data Length
DataLengthP2:=StrToByte("01"\Hex);
!Data / Range
DataP2:=StrToByte("00"\Hex);
SendRequestP2_Set:=StrToByte("01"\Hex);
!
!Send Request Reset Implementation
ClearRawBytes RBSendRequestP2;
ClearRawBytes RBRead;
!Pack the path in header (That is first byte of the Raw container)
PackDNHeader SetAttr,Path_SendRequestP2,RBSendRequestP2;
!Pack the Data in next byte
PackRawBytes
SendRequestP2_Reset,RBSendRequestP2,(RawBytesLen(RBSendRequestP2)+1)\Hex1;
Open "/FCI1:"\File:=DeviceName,Master1\Bin;
WriteRawBytes Master1,RBSendRequestP2\NoOfBytes:=RawBytesLen(RBSendRequestP2);
!ReadRawBytes Master1,RBRead\Time:=1;
Close Master1;
!UnpackRawBytes RBRead,1,answer\ASCII:=10;
!
! !Action Implementation
ClearRawBytes RBActionP2;
ClearRawBytes RBRead;
PackDNHeader SetAttr,Path_ActionP2,RBActionP2;
!Pack the path in header (That is first byte of the Raw container)
PackRawBytes ActionP2,RBActionP2,(RawBytesLen(RBActionP2)+1)\Hex1;
!Pack the Data in next byte
Open "/FCI1:"\File:=DeviceName,Master1\Bin;
WriteRawBytes Master1,RBActionP2\NoOfBytes:=RawBytesLen(RBActionP2);
!ReadRawBytes Master1,RBRead\Time:=1;
Close Master1;
!UnpackRawBytes RBRead,1,answer\ASCII:=10;
! !
! !Index Implementation
ClearRawBytes RBIndexP2;
ClearRawBytes RBRead;
PackDNHeader SetAttr,Path_IndexP2,RBIndexP2;
!Pack the path in header (That is first byte of the Raw container)
PackRawBytes IndexLowByteP2,RBIndexP2,(RawBytesLen(RBIndexP2)+1)\Hex1;
PackRawBytes IndexHighByteP2,RBIndexP2,(RawBytesLen(RBIndexP2)+1)\Hex1;
!Pack the Data in next byte
Open "/FCI1:"\File:=DeviceName,Master1\Bin;
WriteRawBytes Master1,RBIndexP2\NoOfBytes:=RawBytesLen(RBIndexP2);
!ReadRawBytes Master1,RBRead\Time:=1;
Close Master1;
!UnpackRawBytes RBRead,1,answer\ASCII:=10;
! !
! !SubIndex Implementation
ClearRawBytes RBSubIndexP2;
ClearRawBytes RBRead;
PackDNHeader SetAttr,Path_SubIndexP2,RBSubIndexP2;
!Pack the path in header (That is first byte of the Raw container)
PackRawBytes SubIndexP2,RBSubIndexP2,(RawBytesLen(RBSubIndexP2)+1)\Hex1;
-8-
C:\Users\janakg\Desktop\ABB Sample Code\BalluffIOLinkRAPID_Parameterising.mod Wednesday, 6 July 2016 11:26 AM
!Pack the Data in next byte
Open "/FCI1:"\File:=DeviceName,Master1\Bin;
WriteRawBytes Master1,RBSubIndexP2\NoOfBytes:=RawBytesLen(RBSubIndexP2);
!ReadRawBytes Master1,RBRead\Time:=1;
Close Master1;
!UnpackRawBytes RBRead,1,answer\ASCII:=10;
! !
! !Data Length Implementation
ClearRawBytes RBDataLengthP2;
ClearRawBytes RBRead;
PackDNHeader SetAttr,Path_DataLengthP2,RBDataLengthP2;
!Pack the path in header (That is first byte of the Raw container)
PackRawBytes DataLengthP2,RBDataLengthP2,(RawBytesLen(RBDataLengthP2)+1)\Hex1;
!Pack the Data in next byte
Open "/FCI1:"\File:=DeviceName,Master1\Bin;
WriteRawBytes Master1,RBDataLengthP2\NoOfBytes:=RawBytesLen(RBDataLengthP2);
!ReadRawBytes Master1,RBRead\Time:=1;
Close Master1;
!UnpackRawBytes RBRead,1,answer\ASCII:=10;
! !
! !Data Implementation
ClearRawBytes RBDataP2;
ClearRawBytes RBRead;
PackDNHeader SetAttr,Path_DataP2,RBDataP2;
!Pack the path in header (That is first byte of the Raw container)
PackRawBytes DataP2,RBDataP2,(RawBytesLen(RBDataP2)+1)\Hex1;
!Pack the Data in next byte
Open "/FCI1:"\File:=DeviceName,Master1\Bin;
WriteRawBytes Master1,RBDataP2\NoOfBytes:=RawBytesLen(RBDataP2);
!ReadRawBytes Master1,RBRead\Time:=1;
Close Master1;
!UnpackRawBytes RBRead,1,answer\ASCII:=10;
! !
! !Send Request Set Implementation
ClearRawBytes RBSendRequestP2;
ClearRawBytes RBRead;
PackDNHeader SetAttr,Path_SendRequestP2,RBSendRequestP2;
!Pack the path in header (That is first byte of the Raw container)
PackRawBytes SendRequestP2_Set,RBSendRequestP2,(RawBytesLen(RBSendRequestP2)+1)\Hex1;
!Pack the Data in next byte
Open "/FCI1:"\File:=DeviceName,Master1\Bin;
WriteRawBytes Master1,RBSendRequestP2\NoOfBytes:=RawBytesLen(RBSendRequestP2);
!ReadRawBytes Master1,RBRead\Time:=1;
Close Master1;
!UnpackRawBytes RBRead,1,answer\ASCII:=10;
ENDPROC
PROC P3IOLDevice_Parameterising()
!This Sub routine will enable write the parameter on the IOL Device connected on P3
!
!***************IOL Port 3 Parameters*****************************************!
!NOTE: Explicit message paths, Data types and Value range can be found in the EDS
file of BNI005A
!NOTE: Parameter Values, Index and SubIndex values can be found in IO Link Device
manual
!
!Path for "Action" Explicit message to set the Read or Write command of the IO Link
Port 3
! - Class is 67, Instance for IO Link Port 3 is 03, Attribute ID is 06, Data Type
is C6, Data Length is 01
CONST string Path_ActionP3:="6,20 66 24 03 30 06,C6,01";
!
!Path for "Index" Explicit message to set Index of the IO Link Port 3
! - Class is 67, Instance for IO Link Port 3 is 03, Attribute ID is 07, Data Type
is C7, Data Length is 02
CONST string Path_IndexP3:="6,20 66 24 03 30 07,C7,02";
!
!Path for "SubIndex" Explicit message to set Index of the IO Link Port 3
! - Class is 67, Instance for IO Link Port 3 is 03, Attribute ID is 08, Data Type
is C6, Data Length is 01
CONST string Path_SubIndexP3:="6,20 66 24 03 30 08,C6,01";
!
-9-
C:\Users\janakg\Desktop\ABB Sample Code\BalluffIOLinkRAPID_Parameterising.mod Wednesday, 6 July 2016 11:26 AM
!Path for "Data Length" Explicit message to set Index of the IO Link Port 3
! - Class is 67, Instance for IO Link Port 3 is 03, Attribute ID is 09, Data Type
is C6, Data Length is 01
CONST string Path_DataLengthP3:="6,20 66 24 03 30 09,C6,01";
!
!Path for "Data" Explicit message to set Index of the IO Link Port 3
! - Class is 67, Instance for IO Link Port 3 is 03, Attribute ID is 0A, Data Type
is DA, Data Length is 01
CONST string Path_DataP3:="6,20 66 24 03 30 0A,C2,232";
!
!Path for "Send Request" Explicit message to set Index of the IO Link Port 3
! - Class is 67, Instance for IO Link Port 3 is 03, Attribute ID is 0B, Data Type
is C1, Data Length is 01
CONST string Path_SendRequestP3:="6,20 66 24 03 30 0B, C1, 01";
!Variables for Port 3 IO Link Device Parameterisation
VAR rawbytes RBSendRequestP3;
VAR byte SendRequestP3_Reset;
VAR byte SendRequestP3_Set;
VAR rawbytes RBActionP3;
VAR byte ActionP3;
VAR rawbytes RBIndexP3;
VAR byte IndexLowByteP3;
VAR byte IndexHighByteP3;
VAR rawbytes RBSubIndexP3;
VAR byte SubIndexP3;
VAR rawbytes RBDataLengthP3;
VAR byte DataLengthP3;
VAR rawbytes RBDataP3;
VAR byte DataP3;
SendRequestP3_Reset:=StrToByte("00"\Hex);
!Action 02 is for Write, 03 is for Read
ActionP3:=StrToByte("02"\Hex);
!Index (Usually only LOW byte needs to be updated)
IndexLowByteP3:=StrToByte("40"\Hex);
IndexHighByteP3:=StrToByte("00"\Hex);
!SubIndex
SubIndexP3:=StrToByte("00"\Hex);
!Data Length
DataLengthP3:=StrToByte("01"\Hex);
!Data / Range
DataP3:=StrToByte("00"\Hex);
SendRequestP3_Set:=StrToByte("01"\Hex);
!
!Send Request Reset Implementation
ClearRawBytes RBSendRequestP3;
ClearRawBytes RBRead;
!Pack the path in header (That is first byte of the Raw container)
PackDNHeader SetAttr,Path_SendRequestP3,RBSendRequestP3;
!Pack the Data in next byte
PackRawBytes
SendRequestP3_Reset,RBSendRequestP3,(RawBytesLen(RBSendRequestP3)+1)\Hex1;
Open "/FCI1:"\File:=DeviceName,Master1\Bin;
WriteRawBytes Master1,RBSendRequestP3\NoOfBytes:=RawBytesLen(RBSendRequestP3);
!ReadRawBytes Master1,RBRead\Time:=1;
Close Master1;
!UnpackRawBytes RBRead,1,answer\ASCII:=10;
!
! !Action Implementation
ClearRawBytes RBActionP3;
ClearRawBytes RBRead;
PackDNHeader SetAttr,Path_ActionP3,RBActionP3;
!Pack the path in header (That is first byte of the Raw container)
PackRawBytes ActionP3,RBActionP3,(RawBytesLen(RBActionP3)+1)\Hex1;
!Pack the Data in next byte
Open "/FCI1:"\File:=DeviceName,Master1\Bin;
WriteRawBytes Master1,RBActionP3\NoOfBytes:=RawBytesLen(RBActionP3);
!ReadRawBytes Master1,RBRead\Time:=1;
Close Master1;
!UnpackRawBytes RBRead,1,answer\ASCII:=10;
! !
! !Index Implementation
-10-
C:\Users\janakg\Desktop\ABB Sample Code\BalluffIOLinkRAPID_Parameterising.mod Wednesday, 6 July 2016 11:26 AM
ClearRawBytes RBIndexP3;
ClearRawBytes RBRead;
PackDNHeader SetAttr,Path_IndexP3,RBIndexP3;
!Pack the path in header (That is first byte of the Raw container)
PackRawBytes IndexLowByteP3,RBIndexP3,(RawBytesLen(RBIndexP3)+1)\Hex1;
PackRawBytes IndexHighByteP3,RBIndexP3,(RawBytesLen(RBIndexP3)+1)\Hex1;
!Pack the Data in next byte
Open "/FCI1:"\File:=DeviceName,Master1\Bin;
WriteRawBytes Master1,RBIndexP3\NoOfBytes:=RawBytesLen(RBIndexP3);
!ReadRawBytes Master1,RBRead\Time:=1;
Close Master1;
!UnpackRawBytes RBRead,1,answer\ASCII:=10;
! !
! !SubIndex Implementation
ClearRawBytes RBSubIndexP3;
ClearRawBytes RBRead;
PackDNHeader SetAttr,Path_SubIndexP3,RBSubIndexP3;
!Pack the path in header (That is first byte of the Raw container)
PackRawBytes SubIndexP3,RBSubIndexP3,(RawBytesLen(RBSubIndexP3)+1)\Hex1;
!Pack the Data in next byte
Open "/FCI1:"\File:=DeviceName,Master1\Bin;
WriteRawBytes Master1,RBSubIndexP3\NoOfBytes:=RawBytesLen(RBSubIndexP3);
!ReadRawBytes Master1,RBRead\Time:=1;
Close Master1;
!UnpackRawBytes RBRead,1,answer\ASCII:=10;
! !
! !Data Length Implementation
ClearRawBytes RBDataLengthP3;
ClearRawBytes RBRead;
PackDNHeader SetAttr,Path_DataLengthP3,RBDataLengthP3;
!Pack the path in header (That is first byte of the Raw container)
PackRawBytes DataLengthP3,RBDataLengthP3,(RawBytesLen(RBDataLengthP3)+1)\Hex1;
!Pack the Data in next byte
Open "/FCI1:"\File:=DeviceName,Master1\Bin;
WriteRawBytes Master1,RBDataLengthP3\NoOfBytes:=RawBytesLen(RBDataLengthP3);
!ReadRawBytes Master1,RBRead\Time:=1;
Close Master1;
!UnpackRawBytes RBRead,1,answer\ASCII:=10;
! !
! !Data Implementation
ClearRawBytes RBDataP3;
ClearRawBytes RBRead;
PackDNHeader SetAttr,Path_DataP3,RBDataP3;
!Pack the path in header (That is first byte of the Raw container)
PackRawBytes DataP3,RBDataP3,(RawBytesLen(RBDataP3)+1)\Hex1;
!Pack the Data in next byte
Open "/FCI1:"\File:=DeviceName,Master1\Bin;
WriteRawBytes Master1,RBDataP3\NoOfBytes:=RawBytesLen(RBDataP3);
!ReadRawBytes Master1,RBRead\Time:=1;
Close Master1;
!UnpackRawBytes RBRead,1,answer\ASCII:=10;
! !
! !Send Request Set Implementation
ClearRawBytes RBSendRequestP3;
ClearRawBytes RBRead;
PackDNHeader SetAttr,Path_SendRequestP3,RBSendRequestP3;
!Pack the path in header (That is first byte of the Raw container)
PackRawBytes SendRequestP3_Set,RBSendRequestP3,(RawBytesLen(RBSendRequestP3)+1)\Hex1;
!Pack the Data in next byte
Open "/FCI1:"\File:=DeviceName,Master1\Bin;
WriteRawBytes Master1,RBSendRequestP3\NoOfBytes:=RawBytesLen(RBSendRequestP3);
!ReadRawBytes Master1,RBRead\Time:=1;
Close Master1;
!UnpackRawBytes RBRead,1,answer\ASCII:=10;
ENDPROC
PROC P4IOLDevice_Parameterising()
!This Sub routine will enable write the parameter on the IOL Device connected on P4
!
!***************IOL Port 4 Parameters*****************************************!
!NOTE: Explicit message paths, Data types and Value range can be found in the EDS
file of BNI005A
-11-
C:\Users\janakg\Desktop\ABB Sample Code\BalluffIOLinkRAPID_Parameterising.mod Wednesday, 6 July 2016 11:26 AM
!NOTE: Parameter Values, Index and SubIndex values can be found in IO Link Device
manual
!
!Path for "Action" Explicit message to set the Read or Write command of the IO Link
Port 4
! - Class is 67, Instance for IO Link Port 4 is 04, Attribute ID is 06, Data Type
is C6, Data Length is 01
CONST string Path_ActionP4:="6,20 66 24 04 30 06,C6,01";
!
!Path for "Index" Explicit message to set Index of the IO Link Port 4
! - Class is 67, Instance for IO Link Port 4 is 04, Attribute ID is 07, Data Type
is C7, Data Length is 02
CONST string Path_IndexP4:="6,20 66 24 04 30 07,C7,02";
!
!Path for "SubIndex" Explicit message to set Index of the IO Link Port 4
! - Class is 67, Instance for IO Link Port 4 is 04, Attribute ID is 08, Data Type
is C6, Data Length is 01
CONST string Path_SubIndexP4:="6,20 66 24 04 30 08,C6,01";
!
!Path for "Data Length" Explicit message to set Index of the IO Link Port 4
! - Class is 67, Instance for IO Link Port 4 is 04, Attribute ID is 09, Data Type
is C6, Data Length is 01
CONST string Path_DataLengthP4:="6,20 66 24 04 30 09,C6,01";
!
!Path for "Data" Explicit message to set Index of the IO Link Port 4
! - Class is 67, Instance for IO Link Port 4 is 04, Attribute ID is 0A, Data Type
is DA, Data Length is 01
CONST string Path_DataP4:="6,20 66 24 04 30 0A,C2,232";
!
!Path for "Send Request" Explicit message to set Index of the IO Link Port 4
! - Class is 67, Instance for IO Link Port 4 is 04, Attribute ID is 0B, Data Type
is C1, Data Length is 01
CONST string Path_SendRequestP4:="6,20 66 24 04 30 0B, C1, 01";
!Variables for Port 2 IO Link Device Parameterisation
VAR rawbytes RBSendRequestP4;
VAR byte SendRequestP4_Reset;
VAR byte SendRequestP4_Set;
VAR rawbytes RBActionP4;
VAR byte ActionP4;
VAR rawbytes RBIndexP4;
VAR byte IndexLowByteP4;
VAR byte IndexHighByteP4;
VAR rawbytes RBSubIndexP4;
VAR byte SubIndexP4;
VAR rawbytes RBDataLengthP4;
VAR byte DataLengthP4;
VAR rawbytes RBDataP4;
VAR byte DataP4;
SendRequestP4_Reset:=StrToByte("00"\Hex);
!Action 02 is for Write, 03 is for Read
ActionP4:=StrToByte("02"\Hex);
!Index (Usually only LOW byte needs to be updated)
IndexLowByteP4:=StrToByte("40"\Hex);
IndexHighByteP4:=StrToByte("00"\Hex);
!SubIndex
SubIndexP4:=StrToByte("00"\Hex);
!Data Length
DataLengthP4:=StrToByte("01"\Hex);
!Data / Range
DataP4:=StrToByte("02"\Hex);
SendRequestP4_Set:=StrToByte("01"\Hex);
!
!Send Request Reset Implementation
ClearRawBytes RBSendRequestP4;
ClearRawBytes RBRead;
!Pack the path in header (That is first byte of the Raw container)
PackDNHeader SetAttr,Path_SendRequestP4,RBSendRequestP4;
!Pack the Data in next byte
PackRawBytes
SendRequestP4_Reset,RBSendRequestP4,(RawBytesLen(RBSendRequestP4)+1)\Hex1;
Open "/FCI1:"\File:=DeviceName,Master1\Bin;
-12-
C:\Users\janakg\Desktop\ABB Sample Code\BalluffIOLinkRAPID_Parameterising.mod Wednesday, 6 July 2016 11:26 AM
WriteRawBytes Master1,RBSendRequestP4\NoOfBytes:=RawBytesLen(RBSendRequestP4);
!ReadRawBytes Master1,RBRead\Time:=1;
Close Master1;
!UnpackRawBytes RBRead,1,answer\ASCII:=10;
!
! !Action Implementation
ClearRawBytes RBActionP4;
ClearRawBytes RBRead;
PackDNHeader SetAttr,Path_ActionP4,RBActionP4;
!Pack the path in header (That is first byte of the Raw container)
PackRawBytes ActionP4,RBActionP4,(RawBytesLen(RBActionP4)+1)\Hex1;
!Pack the Data in next byte
Open "/FCI1:"\File:=DeviceName,Master1\Bin;
WriteRawBytes Master1,RBActionP4\NoOfBytes:=RawBytesLen(RBActionP4);
!ReadRawBytes Master1,RBRead\Time:=1;
Close Master1;
!UnpackRawBytes RBRead,1,answer\ASCII:=10;
! !
! !Index Implementation
ClearRawBytes RBIndexP4;
ClearRawBytes RBRead;
PackDNHeader SetAttr,Path_IndexP4,RBIndexP4;
!Pack the path in header (That is first byte of the Raw container)
PackRawBytes IndexLowByteP4,RBIndexP4,(RawBytesLen(RBIndexP4)+1)\Hex1;
PackRawBytes IndexHighByteP4,RBIndexP4,(RawBytesLen(RBIndexP4)+1)\Hex1;
!Pack the Data in next byte
Open "/FCI1:"\File:=DeviceName,Master1\Bin;
WriteRawBytes Master1,RBIndexP4\NoOfBytes:=RawBytesLen(RBIndexP4);
!ReadRawBytes Master1,RBRead\Time:=1;
Close Master1;
!UnpackRawBytes RBRead,1,answer\ASCII:=10;
! !
! !SubIndex Implementation
ClearRawBytes RBSubIndexP4;
ClearRawBytes RBRead;
PackDNHeader SetAttr,Path_SubIndexP4,RBSubIndexP4;
!Pack the path in header (That is first byte of the Raw container)
PackRawBytes SubIndexP4,RBSubIndexP4,(RawBytesLen(RBSubIndexP4)+1)\Hex1;
!Pack the Data in next byte
Open "/FCI1:"\File:=DeviceName,Master1\Bin;
WriteRawBytes Master1,RBSubIndexP4\NoOfBytes:=RawBytesLen(RBSubIndexP4);
!ReadRawBytes Master1,RBRead\Time:=1;
Close Master1;
!UnpackRawBytes RBRead,1,answer\ASCII:=10;
! !
! !Data Length Implementation
ClearRawBytes RBDataLengthP4;
ClearRawBytes RBRead;
PackDNHeader SetAttr,Path_DataLengthP4,RBDataLengthP4;
!Pack the path in header (That is first byte of the Raw container)
PackRawBytes DataLengthP4,RBDataLengthP4,(RawBytesLen(RBDataLengthP4)+1)\Hex1;
!Pack the Data in next byte
Open "/FCI1:"\File:=DeviceName,Master1\Bin;
WriteRawBytes Master1,RBDataLengthP4\NoOfBytes:=RawBytesLen(RBDataLengthP4);
!ReadRawBytes Master1,RBRead\Time:=1;
Close Master1;
!UnpackRawBytes RBRead,1,answer\ASCII:=10;
! !
! !Data Implementation
ClearRawBytes RBDataP4;
ClearRawBytes RBRead;
PackDNHeader SetAttr,Path_DataP4,RBDataP4;
!Pack the path in header (That is first byte of the Raw container)
PackRawBytes DataP4,RBDataP4,(RawBytesLen(RBDataP4)+1)\Hex1;
!Pack the Data in next byte
Open "/FCI1:"\File:=DeviceName,Master1\Bin;
WriteRawBytes Master1,RBDataP4\NoOfBytes:=RawBytesLen(RBDataP4);
!ReadRawBytes Master1,RBRead\Time:=1;
Close Master1;
!UnpackRawBytes RBRead,1,answer\ASCII:=10;
! !
-13-
C:\Users\janakg\Desktop\ABB Sample Code\BalluffIOLinkRAPID_Parameterising.mod Wednesday, 6 July 2016 11:26 AM
! !Send Request Set Implementation
ClearRawBytes RBSendRequestP4;
ClearRawBytes RBRead;
PackDNHeader SetAttr,Path_SendRequestP4,RBSendRequestP4;
!Pack the path in header (That is first byte of the Raw container)
PackRawBytes SendRequestP4_Set,RBSendRequestP4,(RawBytesLen(RBSendRequestP4)+1)\Hex1;
!Pack the Data in next byte
Open "/FCI1:"\File:=DeviceName,Master1\Bin;
WriteRawBytes Master1,RBSendRequestP4\NoOfBytes:=RawBytesLen(RBSendRequestP4);
!ReadRawBytes Master1,RBRead\Time:=1;
Close Master1;
!UnpackRawBytes RBRead,1,answer\ASCII:=10;
ENDPROC
ENDMODULE

-14-

You might also like