Please enable JavaScript to view this site.

DAQFactory User's Guide

Navigation: 16 Serial and Ethernet Communications > 16.9 Predefined Protocols

16.9.1 Allen Bradley DF1 protocol

Scroll Prev Top Next More

This protocol allows you to use full-duplex DF1 protocol (System point-to-point) to communicate with ALLEN-BRADLEY SLC-500 PLCs and any other PLC supporting DF1.

There are two ways within DAQFactory to communicate with your DF1 device.  You can use channels as you would other devices, or you can use device functions.  You can use a combination of methods as well.  Both methods require you to setup a serial / Ethernet device first.  This is done with the device configurator which was described just previously.  The DF1 protocol uses a slightly different addressing method than most PLCs.  

Please note: ENQ retry should be disabled on your PLC.  It is not implemented by DAQFactory and should not be needed.

Addressing:

The general format of item names for data from DF1 controllers matches the naming convention used by the programming software. The format is shown below. (The parts of the name shown in square brackets ([ ]) are optional.)

X [FILE] : ELEMENT [.FIELD] [/BIT]

X: Identifies the file type. The list below summarizes the valid file types and the default file number for each type:

X

File Type

Default File

O

*Output

0

I

*Input

1

S

Status

2

B

Binary

3

T

Timer

4

C

Counter

5

R

Control

6

N

Integer

7

F

**Floating P

8

* Output and Input file types may be Read Only depending on the SLC-500 model.

** Available only on certain SLC500 models. Check the Processor Manual for the model being used. If the Floating Point file type is not supported, file 8 is reserved and unusable.

FILE: File number must be 0-255 decimal. File 0 must be Output, file 1 must be Input, file 2 must be Status and so on for all the default file types. If this number is not specified, the default file number will be used.

ELEMENT: Element number within the file. For Input and Output files it must be between 0 and 30 decimal. All other file types, it must be between 0 and 255 decimal.

FIELD: Refers to the subelement number. If the file type is Timer, Counter or Control, then the subelement field must be replaced by its corresponding number. In some cases there is no reference needed for a subelement number, and if a subelement is included in the command, it will be ignored.

BIT: Valid for all file types except Floating Point. Must be 0-15 decimal.  When setting discrete outputs in groups, you cannot specify a group that passes a word boundary.  In other words, if you have a BIT value of 14, you can only set two bits at a time.  It will not roll over to the next word.

File Items:

OUTPUT FILE ITEMS:

O[n]:e.s[/b]

- "n" represents the file number and is optional. If not specified, it is assumed to be zero.

- "e" indicates the element number in the file.

- "s" indicates the sub-element number (0 - 255).

- "b" specifies the bit (0 - 15 decimal.) "/b" may be omitted if necessary to treat the I/O group as a numeric value.

Examples:

 

O0:0/0

O:2/15

O:3

INPUT FILE ITEMS:

I[n]:e.s[/b]

- "n" represents the file number and is optional. If not specified, it is assumed to be one.

- "e" indicates the element number in the file.

- "s" indicates the sub-element number (0 - 255).

- "b" specifies the bit (0 - 15 decimal.) "/b" may be omitted if necessary to treat the I/O group as a numeric value.

Examples:

 

I1:0/0

I:2/15

I:3

ADDRESSING I/O MODULES:

The elements (words) in I/O modules are mapped into a memory table. If the Analog I/O modules are being used, then the point naming will differ from the point naming in the programming software. The Item Name must be computed from the sum total of words used by the previous input or output blocks regardless their relative position in the module rack. The operator can use the programming software Data Monitor to look at the memory map of the I file or O file to verify your address. If the address is unsure, or if the PLC configuration is likely to change, copy the points in question to the N table or B table and access the data from there.

LABEL I/O MODULES WITH "WORD COUNTS":

The address of any point within the I/O datatable space, in an SLC processor, is the sum of the words occupied by previous modules (to the left in the rack) of the same type. Therefore, to determine the correct address for any particular point in the I/O datatable, one must know the number of words each module will consume. Refer to the list below:

N. of Words Module

0 1747-L524 SLC 5/02 Module Processor

1 1746-IA8 8 point 120VAC input module

1 1746-OA16 16 Point 120VAC output module

1 1746-IA16 16 point 120VAC input module

4 1746-NI4 4 point 20mA analog input module

4 1746-NO4I 4 point 20mA analog output module

1 1746-0A8 8 point 120VAC input module

2 1746-IB32 32 point DC input module

Note: In the table above, the minimum amount of words which can be consumed by a module is 1 (16 bits). This is due to the memory scheme of all Allen-Bradley processors.

STATUS FILE ITEMS:

S[n]:e[/b]

- "n" represents the file number and is optional. If not specified, it is assumed to be two.

- "e" indicates the element number in the file (0 - 255 decimal).

- "b" is optional. If specified, it indicates the bit (0 - 15 decimal).

Note: Refer to the SLC-500 Family Processor Manual (Allen-Bradley Publication) for a complete description of Status file information.

Examples:

 

S2:6 (major error fault)

S2:13 (math register)

S:1/5 (forces enabled)

BINARY FILE ITEMS:

B[n]:e/b or B[n]/m

- "n" represents the file number and is optional. If not specified, it is assumed to be three. If specified, the file number must be between 9 and 255 decimal.

- "e" specifies the element (word) number within the Binary file. It must be between 0 and 255 decimal.

- "b" specifies the bit number within the word. In the first form (where ":e" is present,) the bit number must be between 0 and 15 decimal.

- "m" also represents the bit number. However, in the second form, no word number is specified and the bit number may be between 0 and 4095.

Examples:

 

B3/4095 (same bit as B:255/15)

B:6/4 (same bit as B/100)

B3

TIMER FILE ITEMS:

T[n]:e[.f][/b]

- "n" represents the file number and is optional. If not specified, it is assumed to be four. If specified, the file number must be between 9 and 255 decimal.

- "e" specifies the element number (three words per element) within the Timer file. It must be between 0 and 255 decimal.

- "f" identifies one of the valid Timer fields. The valid fields for Timer Files are listed in the table below (use the numeric order as reference). If "f" is omitted, it is assumed to be the word 0.

- "b" is optional and is normally not used. All of the fields of a timer can be accessed by specifying the ".f" fields. However, it is possible to use "/b" to single out a bit in the .PRE or .ACC fields (which are words).

Order number Timer Fields

0 .PRE

1 .ACC

2 .EN

3 .TT

4 .DN

Examples:

 

T4:0.1 (means: .ACC)

T4:3.4 (means: .DN)

T4:1.0 (means: .PRE)

COUNTER FILE ITEMS:

C[n]:e[.f][/b]

- "n" represents the file number and is optional. If not specified, it is assumed to be five. If specified, the file number must be between 9 and 255 decimal.

- "e" specifies the element number (three words per element) within the Counter file. It must be between 0 and 255 decimal.

- "f" identifies one of the valid Counter fields. The valid fields for the Counter Files are listed in the table below (use the numeric order as reference). If "f" is omitted, it is assumed to be the word 0.

- "b" is optional and is normally not used. All of the fields of a counter can be accessed by specifying the ".f" fields. However, it is possible to use "/b" to single out a bit in the .PRE or .ACC fields (which are words).

Order number Counter Fields

0 .PRE

1 .ACC

2 .CU

3 .CD

4 .DN

5 .OV

6 .UN

7 .UA

Examples:

 

C5:0.1 (means: .ACC)

C5:3.5 (means: .OV)

C5:1.0 (means: .PRE)

CONTROL FILE ITEMS:

R[n]:e[.f][/b]

- "n" represents the file number and is optional. If not specified, it is assumed to be six. If specified, the file number must be between 9 and 255 decimal.

- "e" specifies the element number (three words per element) within the Control file. It must be between 0 and 255 decimal.

- "f" identifies one of the valid Control fields. The valid fields for the Control files are listed in the table below (use the numeric order as reference). If "f" is omitted, it is assumed to be the word 0.

- "b" is optional and is normally not used. All of the fields of a Control file can be accessed by specifying the ".f" fields. However, it is possible to use "/b" to single out a bit in the .LEN or .POS fields (which are words).

Order number Control Fields

0 .LEN

1 .POS

2 .EN

3 .DN

4 .ER

5 .UL

6 .IN

7 .FD

Examples:

 

R6:0.0 (means: .LEN)

R6:3.2 (means: .EN)

R6:1.1 (means: .POS)

INTEGER FILE ITEMS:

N[n]:e[/b]

- "n" represents the file number and is optional. If not specified, it is assumed to be seven. If specified, the file number must be between 9 and 255 decimal.

- "e" specifies the element number within the Integer file. It must be between 0 and 255 decimal.

- "b" is optional. If specified, it indicates the bit (0 - 15 decimal).

Examples:

 

N7:0

N7:0/15

N7:3

FLOATING POINT FILE ITEMS:

F[n]:e

- "n" represents the file number (optional). If not specified, it is assumed to be eight. If specified, the file number must be between 9 and 255 decimal.

- "e" specifies the element number within the Floating Point file. It must be between 0 and 255 decimal.

Examples:

 

F8:0

F8:2

{If you are using 1747-KE}

Note: Remember to configure the 1747-KE using the following settings:

- Use the DF1 FULL DUPLEX Protocol

- Use the checksum mode (BCC or CRC) as stated in P5 parameter.

- Use the baud-rate, parity, stop bits and data bits that are currently used in the driver settings.

Note: You should verify these settings by connecting your PC to the 1747-KE CONFIG port using an ASCII terminal (i.e. PROCOMM or XTALK) and then follow the steps described in the 1747-KE User Manual.

Note: Be careful to include the 1747-KE node address as the source node if it is other than 0.

DF1 Channels:

If you are reading a small number of inputs, the channel method of acquiring data from your SLC-500 device is the easier method.  It is not the most efficient however, because each tag that is read from your device requires a separate request.  After creating a new communications device as described previously, create a new channel, select your device name for the device type, enter the ID of the unit you are trying to communicate with as the device #, select the particular DF1 command from the I/O type, and enter the SLC-500 memory address as the Quick Note / Special / OPC column.  The Channel # parameter can be anything and is ignored.  

I/O Types:

All of these types will read or output to a single memory location:

 

Read Analog BCC

Read Analog CRC

Read Binary BCC

Read Binary CRC

Write Analog BCC

Write Analog CRC

Write Binary BCC

Write Binary CRC

DF1 Functions:

This device includes functions accessible from sequences for more advanced control over your device.  The biggest benefit of using device functions over creating individual channels is that you can read groups of memory locations with a single call which is more efficient.  For smaller applications this may not be a problem, but if you need to read large blocks of consecutive tags, you will probably want to consider using device functions.  

There are two basic formats for the device functions, input and output.  Input functions take the ID of the device you wish to communicate with, the starting address, the number of points to read, and whether to use CRC or BCC.  Input functions return an array of values corresponding to the data read.  Output functions also take the same parameters, but take an array of values to set your memory locations to instead of the number of values.  Output functions do not return anything.

You will still need to create a new communications device as described previously.  For these examples, we'll assume you called it MyDevice.

Example - reading 8 holding register values: data = Device.MyDevice.ReadAnalog(10,"F8:0",8,0)  This will read 8 values from device ID #10 starting memory location F8:0 in BCC mode and store the result in the data memory variable (which was declared previously).

Example - using the device function to pull blocks of data into channels:

1. Starting from a blank document, create your communications device using the Device Configurator.

2. Click on CHANNELS: in the workspace to go to the channel table.  Click on the Add button to add a new channel row.  Give the row the name Input10.  You can of course use more appropriate names if you would like.  Set the Device Type to MyDevice or whatever you named your communication device.  Set the Timing column to 0.  This last step is very important otherwise DAQFactory will start to poll the device directly for this channel.  With the exception of the Channel Name, which must be unique, and the Timing, which must be set to 0, you can set the other channel parameters to anything.  We still recommend selecting a device type that matches your device.

3. Click on the Duplicate button 7 times to create 7 new channels based off of the one you just created.  DAQFactory will automatically give each the name: Input11, Input12, etc.  Click Apply to save your changes.

4. Right click on SEQUENCES: in the workspace and select Add Sequence to create a new sequence.  Call the new sequence GroupRead and click OK.  You will be placed in the sequence view ready to edit your sequence.  Here is the code to enter:

 

private data

while (1)

  data = Device.MyDevice.ReadAnalog(10,"F8:0",8,0)

  Input10.AddValue(Private.data[0][0])

  Input11.AddValue(Private.data[0][1])

  Input12.AddValue(Private.data[0][2])

  Input13.AddValue(Private.data[0][3])

  Input14.AddValue(Private.data[0][4])

  Input15.AddValue(Private.data[0][5])

  Input16.AddValue(Private.data[0][6])

  Input17.AddValue(Private.data[0][7])

  delay(1)

endwhile

5. Click Apply to save your sequence.  Now click on the + sign next to SEQUENCES in the workspace to expand the tree, then right click on the GroupRead sequence and select Begin Sequence.

6. Now go to the channel view for any of your register channels and look at the table of the data coming in.  (click on the + next to CHANNELS:, then click on the channel name and select the Table tab).  The sequence loops once a second and reads 8 addresses in a single call to your device.  The 8 Input statements in the middle add the newly read values to the channels you created earlier.

For those wondering why the data always has [0] after it, then [x] where x is the tag number: the first dimension of arrays in DAQFactory is always in time.  Since all these values were read at once they all have the same time so all are on the same row (first dimension).  Besides consistency, this allows you to create 2 dimensional arrays of data from multiple tags very easily.

Example - setting 8 outputs:

 

Private outdata = {{1,0,0,1,0,0,0,1}}

Device.MyDevice.WriteBinary(32,"N7:0/3",Private.outdata,1)

This will set 8 addresses on device ID #32 starting at memory location N7:0/3 in CRC mode.  The values will be on, off, off, on, off, off, off, and on and will start at the 3rd bit of N7:0.

Note that you cannot set bits across a word boundary in a single call.

Functions:

 

ReadAnalog

ReadBinary

WriteAnalog

WriteBinary