EtherNet/IP™ Adapter3.09.01
 
Loading...
Searching...
No Matches
Studio 5000 Logix Designer with Allen-Bradley CompactLogix Controller

The example is prepared to run on an Allen-Bradley CompactLogix 5370 controller communicating with an EtherNet/IP Adapter implementing a General Purpose Discrete I/O Device profile running on a Texas Instruments LP-AM261 LaunchPad™ development kit.

Both Explicit and Implicit messaging are demonstrated in the example.

Studio 5000 and Device Description Installation

Allen-Bradley CompactLogix 5370, model 1769-L16ER, controller is programmed using Studio 5000 development environment.

Adding an EDS File

To add a different EDS file that is not listed in the known EDS files click on "Tools → Device Description Installation Tool".

Example Structure

The project is created in Structured Text and divided into three routines that are run from the main routine and triggerred by a timer every 100 milliseconds.

TONR(FbdTimer1);
FbdTimer1.PRE := 100;
FbdTimer1.TimerEnable := NOT FbdTimer1.DN;
if FbdTimer1.DN then
JSR(ExplicitMsg_Section);
JSR(ImplicitMsg_Section);
end_if;

The subroutines are:

ExplicitMsg_Section
Send Get_Attribute_Single request to read out the TimeSync "IsSynchronized" attribute (calss 0x43, instance 1, attribute 2)

Please make sure to enable the Time Synchronization in controller properties, as can be seen in the picture below:

//Read TimeSync attribute 2 (IsSynchronized)
CIP_Explicit_MSG.Class := 16#43;
CIP_Explicit_MSG.Instance := 16#01;
CIP_Explicit_MSG.Attribute := 16#02;
MSG(CIP_Explicit_MSG);

ImplicitMsg_Section
This code transmits implicit messages to manage Discrete Output Points (DOPs), each controlling an individual LED.

The program employs a simple counter mechanism that increments from 0 to 15 before resetting to 0 and repeating the cycle.
Each bit within the payload byte corresponds to a specific Discrete Output Point. As the counter value changes, the binary representation in the payload updates accordingly, creating visible patterns across the LEDs.

AM261x_LP_DiscreteIO:O.Data[0] := ImpicitMsg_O_Data;
ImpicitMsg_O_Data := ImpicitMsg_O_Data + 1;
if ImpicitMsg_O_Data > 15 then
ImpicitMsg_O_Data := 0;
end_if;

Running the Example on PLC

Download the Example to the PLC

Verify the the hardware swith on the PLC (RUN/REM/PROG) is set into REM position. To download the example to the PLC, from dropdown menu click "Download".

Getting Online with The PLC

After downloading if you are not automatically prompted to move to "Rem Run", from the dropdown menu click "Run Mode".

Monitoring changes through Controller Tags

When online, you can observe these Implicit messages changes from Controller Tags on the left menu bar. In this example we can specifically observe "AM261x_LP_DiscreteIO:O.Data[0]" and "AM261x_LP_DiscreteIO:I.Data[0]" changing.