MicroLogix Data Log Queues

 

(See Rockwell Publication: 1763-RM001B-EN-P "MicroLogix Programmable Controller Instruction Set Reference Manual" for information on creating data logging queues)

The MicroLogix 1100 and 1500 controllers can store application data as a record for retrieval at a later time. Each record is stored in a user-configured queue in battery backed RAM. Log records are READ_ONLY and can be retrieved from a MicroLogix processor using INGEAR.NET.ABLINK.  Within the MicroLogix processor you can define up to 256 (0 to 255) data logging queues. Queues are configured in the MicroLogix by size and length.  A queue length is the maximum number of records stored in each queue. The record length is number bytes per logged event (up to 80 bytes).

 

Record Field Sizes

Data Type

Field Length

WORD

7 bytes (characters)

LONG WORD

12 bytes (characters)

DATE FIELD

11 bytes (characters)

TIME FIELD

9 bytes (characters)

Record Length = [FIELD 1] + [FIELD 2] + [FIELD 3] + [...] + [FIELD n]

 

In this example log a DATE FIELD, TIME FIELD, and 3 WORD FIELDS are being logged as a record.  The record length is calculated as follows:

DATE(11 bytes) + TIME(9 bytes) + N7:0(7 bytes) + N7:1 (7 bytes) + T4:0.PRE (7 bytes)

Length = 11+9+7+7+7

Length = 41

Record Format

Data Log Records are returned as a ASCII string in the following format:

<DATE><sep><TIME><sep><FIELD 1><sep><FIELD 2><sep><...><FIELD n>

Example Record: "05/02/2008,11:12:56,66,3004,200"

Data Log Record Retrieval

Data Log Records in the MicroLogix are stored in a FIFO (FIRST IN - FIRST OUT), therefor Data Log Records are retrieved OLDEST to NEWEST. When a record it retrieved, it is deleted from the Data Log Queue by the MicroLogix. When all records have been retrieved, the MicroLogix will return STS error code 16 (0x10) - "Illegal Command or Format".

CODE EXAMPLE

VB

Imports ABLink ' *********************************** ' * initialize controller Dim MyPLC as New Controller() ' *********************************** ' * initialize tag (QUEUE 0) Dim MyTag as New Tag("Q:0") ' *********************************** ' * set controller properties MyPLC.IPAddress = "192.168.1.139" MyPLC.CPUType = CPU.MLC MyPLC.DriverType = Driver.ENETIP ' ***********************************

' * set the length of the Data Log Record

MyTag.Length = 41

' *********************************** ' * read the Data Log Record MyPLC.ReadTag(MyTag) If MyTag.QualityCode = ResultCode.QUAL_GOOD Then  Console.WriteLine(MyTag.Value)  Console.WriteLine(MyTag.Timestamp.ToString()) Else  Console.WriteLine(MyTag.ErrorString) End If Console.WriteLine(MyTag.QualityString)   

C#

using ABLink; ////////////////////////////////////// // initialize controller class Controller MyPLC = new Controller(); ////////////////////////////////////// // initialize tag class (QUEUE 0) Tag MyTag = new Tag("Q:0"); ///////////////////////////////////// // set controller properties MyPLC.IPAddress = "192.168.1.139"; MyPLC.CPUType = CPU.MLC; MyPLC.DriverType = Driver.ENETIP;

////////////////////////////////////

// set the length of the Data Log Record

MyTag.Length = 41; //////////////////////////////////// // read the Data Log Record MyPLC.ReadTag(MyTag); if (ResultCode.QUAL_GOOD == MyTag.QualityCode) {    Console.WriteLine(Convert.ToString(MyTag.Value));  Console.WriteLine(MyTag.Timestamp.ToString()); } else   Console.WriteLine(MyTag.ErrorString); Console.WriteLine(MyTag.QualityString);