6 1 Direct NET Host

6 1 Direct NET Host
DirectNET Host
Communications
Programs
16
In This Chapter. . . .
— Why do you need a communications program?
— Modes of Operation
— Protocol Components
— Controlling the Communications
— Initiating the Request
— Acknowledging the Request
— Defining the Request
— Transferring Data
— Calculating the Header Checksum
— Ending the Request
— Timing Considerations
— What part of the manual should you use next?
DirectNET Host
Communications Prog.
6–2
DirectNET Host Communications Programs
Why do you need a communications program?
The Master
Initiates Requests
Since DirectNET is a master / slave network, the master station must initiate
requests for network data transfers. If you’re using a host as the master station, you
will need to use a communications program written with the DirectNET protocol.
DirectNET
Programs
The communications program used with a hosted network is more complex than the
simple RLL instructions used with the other configurations, but the concept is the
same. The host is the DirectNET master and must use a DirectNET protocol
communications program to initiate all network requests to read or write data. These
communication programs can be written in many different languages, such as
BASIC, C, etc. and must include the appropriate DirectNET commands.
Here’s an example of a DirectNET program. (This is just part of the program.)
DirectNET Program in BASIC
10
REM Program to read X0–X7 from a DL405 PLC
20
REM
30
REM Define all variables
40
REM
50
REM Change the slave address in HEX at line 60 if required.
60
SLAVEADDRESS=&H1
70
DATATYPE$=CHR$(&H32)
80
DATAADDR$=CHR$(&H30)+CHR$(&H31)+CHR$(&H30)+CHR$(&H31)
90
COMPLETEBLK$=CHR$(&H30)+CHR$(&H30)
100
PARTBLK$=CHR$(&H30)+CHR$(&H32)
110
MASTERADDR$=CHR$(&H30)+CHR$(&H30)
120
NORMAL$=CHR$(&H4E)
130
SLAVEADDR$=HEX$(SLAVEADDRESS)
140
IF LEN(SLAVEADDR$)<2 THEN SLAVEADDR$=”0”+SLAVEADDR$
150
OFFSETADDR$=CHR$(&H20+SLAVEADDRESS)
NOTE: This manual does not show you how to build communications programs that
manage the data storage and communications ports. You should check the
documentation that came with your programming software to determine the
appropriate techniques to solve these requirements.
DirectNET Host Communications Programs
6–3
Master
Read Request
Slave
Initiate
Request
Acknowledge
Define Request
Acknowledge
Receipt of Data
Acknowledge and
Respond with
Data
Finished – All
Data Sent
Finished
Write Request
Initiate
Request
Acknowledge
Define Request
Acknowledge
Transmit Data
Acknowledge
Receipt of Data
Finished
The remainder of this chapter discusses the individual elements of DirectNET
protocol programs.
DirectNET Host
Communications Prog.
The following diagram shows the general structure of the communications. The
program must:
S identify the slave station.
S indicate the type and amount of data to transfer.
S manage the communications between the master and slave.
DirectNET Host
Communications Prog.
6–4
DirectNET Host Communications Programs
Modes of Operation
Transmission
Bytes
DirectNET can transfer a maximum of 65,791 bytes ( 256 blocks 256 bytes each +
an additional 255 bytes) in a single request. The actual amount of system
information that is transferred depends on the mode of operation.
HEX or ASCII Mode There are two modes used with the DirectNET protocol, HEX or ASCII. You must
choose the mode of operation before you write the program. The major difference is
in the way the data is represented in the data packet. ASCII mode requires twice as
many bytes to transfer data. There are also minor differences in the command
structure which affect the way the enquiries and headers operate.
NOTE: This only applies to a Host master, since the DCM has the capability to detect
the data transfer mode and adjust for the additional number of bytes to be used when
transferring in ASCII mode.
If you’re transferring small amounts of data, or if the data is not being used to control
system timing, then it’s generally easier to use ASCII mode for DirectNET
programs. You should use HEX mode if you’re transferring large amounts of data
and you need the fastest possible communication time.
The following diagram shows the difference between HEX and ASCII modes.
HEX Mode
Transfer 8 Output Points
Byte 1
7
0
Y0 – Y7
1 byte
7
0
ASCII Mode
Byte 1
bits 0 – 3 in ASCII code
+
Byte 2
bits 4 – 7 in ASCII code
6–5
DirectNET Host Communications Programs
In HEX mode, the number of bytes transferred is equal to the number of bytes for the
selected data type. ASCII mode requires twice as many bytes to transfer the same
data. Here’s a listing of the data types and their corresponding byte requirements.
DL205/405
D t T
Data
Type
Description
Bits per
unit
it
Number of bytes
HEX
ASCII
31
V memory
T / C current value
16
16
2
2
4
4
32
Inputs (X, GX, SP)
8
1
2
33
Outputs
(Y, C, Stage, T/C bits)
8
1
2
39
Diagnostic Status
8
1
2
DL305
Data
D
t T
Type
Description
Bits per
unit
it
Number of bytes
HEX
ASCII
31
Data registers
T / C accumulator
8
16
1
2
2
4
33
I/O, internal relays,
shift register bits, T/C
bits, stage bits
1
1
2
39
Diagnostic Status
(5 word R/W)
16
10
20
DirectNET Host
Communications Prog.
Data Type Byte
Requirements
DirectNET Host
Communications Prog.
6–6
DirectNET Host Communications Programs
Protocol Components
All DirectNET program read and write requests use the following protocol
components.
S Enquiry (ENQ) – initiates a request (from the master) with the slave
stations.
S Header (HDR) – defines the operation as a read or write, the slave
station address, and the type and amount of data to be transferred.
S Data (DATA) – the actual data that is being transferred.
S Acknowledge (ACK) – verifies communication is working correctly.
S End of Transmission (EOT) – indicates the communication is finished.
DirectNET Host Communications Programs
6–7
Master
Read Request
ENQ
Slave
Initiate
Request
Acknowledge
HDR
ACK
Write Request
Acknowledge
Receipt of Data
EOT
Finished
ENQ
Initiate
Request
HDR
DATA
EOT
ACK
Define Request
Acknowledge and
Respond with
Data
ACK – DATA
Finished – All
Data Sent
EOT
Acknowledge
ACK
Acknowledge
ACK
Acknowledge
Receipt of Data
ACK
Define Request
Transmit Data
Finished
DirectNET Host
Communications Prog.
The following diagram shows how the protocol components are used with read and
write requests.
DirectNET Host
Communications Prog.
6–8
DirectNET Host Communications Programs
Controlling the Communications
Control Codes
All read or write requests use ASCII control codes and a Longitudinal Redundancy
Check (LRC) to manage the communications between the master and slave. The
control codes identify the beginning and ending of the protocol components such as,
enquiry, acknowledge, etc. The LRC is used to ensure the data was transmitted and
received correctly.
Symbol
HEX
ASCII
Code
ENQ
05
Enquiry – initiate request
ACK
06
Acknowledge – the communication was received without
error
NAK
15
Negative Acknowledge – there was a problem with the
communication
SOH
01
Start of Header – beginning of header
ETB
17
End of Transmission Block – end of intermediate block
STX
02
Start of Text – beginning of data block
ETX
03
End of Text – End of last data block
EOT
04
End of Transmission – the request is complete.
Description
DirectNET Host Communications Programs
6–9
Read Request
Master
ENQ
Write Request
Slave
N
Target Address
ENQ
ENQ
N
Target Address
ACK
HDR
HDR
STX
Full Data Block
ETB
LRC
ACK
ACK
ACK
ACK
ACK
ACK
STX
Full Data Block
ETB
LRC
DATA
DATA
STX
Last Data Block
ETX
LRC
ACK
EOT
EOT
ACK
ACK
STX
Last Data Block
ETX
LRC
ACK
DATA
N
Target Address
ACK
SOH
Header
ETB
LRC
ACK
DATA
Slave
N
Target Address
ENQ
ACK
SOH
Header
ETB
LRC
ACK
ACK
Master
EOT
EOT
EOT
EOT
DirectNET Host
Communications Prog.
The following diagram shows how these control codes are combined with the protocol components to build
the DirectNET format for read and write requests. Note, the slave components are automatically generated
as a response to the requests from the master station. Your custom DirectNET program must generate the
protocol components for the master station.
DirectNET Host
Communications Prog.
6–10
DirectNET Host Communications Programs
Initiating the Request
Enquiry
ENQ
The Enquiry is a three character message that initiates the request with the
appropriate slave station. The message always begins with 4E (“N”), which means
normal enquiry sequence. The second character contains the offset station address,
which is the station address plus HEX 20. The last character is the ASCII control
code for ENQ.
Hexadecimal ASCII code for “N”
ENQ
N
Target Address
ENQ
Byte 1
Byte 2
Byte 3
4E
22
05
Offset slave address.
Example –
Address HEX 2 + HEX 20 = HEX 22
ASCII control code for ENQ
Note: Slave addresses for the DL430, DL440, DL340 and the DCU
have been set in decimal. It will be necessary for you to convert the address from decimal to the Hexadecimal equivalent before adding the
HEX 20 offset.
60 Decimal
HEX Format
16 60
48
12
3C Hexadecimal
6–11
DirectNET Host Communications Programs
Acknowledge
ACK – NAK
The three character acknowledge commands are used by both the master and slave
stations to indicate the status of the communication. An ACK is used if the
information was transmitted (or received) without any problems. If there are
problems, Not Acknowledge (NAK) is used.
A NAK will also be returned from the slave if something is incorrect in the header or
data packet. This could be incorrect byte boundaries, an invalid address, etc. If the
master receives a NAK response, it can either try to re-transmit the data, or it can
terminate the request and try again.
The first two characters are the same as the Enquiry sequence. The third character
is the control code for an ACK or NAK.
N
Target Address
ACK
Hexadecimal ASCII code for “N”
Byte 1
Byte 2
Byte 3
4E
22
06 or 15
Offset slave address.
Example –
Address HEX 2 + HEX 20 = HEX 22
ACK
ASCII control code for ACK (06)
or NAK (15)
Delayed Response When text is being transmitted over the network, there may be character
combinations that are identical to an enquiry sequence. Network slave stations
to an Enquiry
would interpret the character sequence as an enquiry even though it was actually
data being sent to an identified slave.
A delay has been implemented to automatically eliminate this possibility. The delay
occurs between the receipt of an enquiry from the master and the acknowledgment
response from the slave. When the slave recognizes an enquiry sequence an
internal timer (with the time preset to the amount of time to transmit 2 characters) is
started. The slave ignores the enquiry if another character is received before the
timeout period has elapsed.
DirectNET Host
Communications Prog.
Acknowledging the Request
DirectNET Host
Communications Prog.
6–12
DirectNET Host Communications Programs
Defining the Request
Header – HDR
The header is a 17-byte (18-byte for ASCII transmissions) message that defines the
operation. It is sent by the master station and specifies the following.
S type of operation (read or write)
S type of data being transferred
S data address
S number of complete data blocks
S number of bytes in the last data block
SOH
Header
ETB
LRC
HDR
ASCII Coded Representation Example
Byte:
1
2, 3
4
5
6, 7
8, 9
10, 11
12, 13
14, 15
16
17(18)
01
3034
30
31
3431
3031
3031
3930
3031
17
08
3038
SOH
Target
Slave
Read
or
Write
Data
Type
Starting Starting Number Bytes
Address Address Com- in Last
Block
MSB
LSB
plete
Blocks
Master
ID
Hex
ASCII
ETB LRC
Byte 1:
Start of Header
The first byte in the header is the ASCII control code (01) that indicates this is the
beginning of a header.
Bytes 2 & 3:
Target Slave
Address
The second and third bytes of the header indicate which slave station will be used.
This is the normal slave station address (in HEX ASCII code) that you assigned
during the network setup. This is not the offset slave station address, (with 20 HEX
added to the address), that is used with the enquiry sequence. For example, a slave
station with address 04 would be 3034 in ASCII code.
The table below shows how to decode the HEX/ASCII slave address. Remember if
the slave address is in HEX it will be necessary to translate the address to decimal
before decoding the HEX ASCII address. In the example below a slave station has a
network address of 04 decimal and the equivalent HEX ASCII code is 3034.
Decimal or ASCII Station Address
04
ASCII Character
HEX Code
0
30
1
31
2
32
3
33
4
34
3034
Target Slave Address
in HEX ASCII Code
5
35
6
36
7
37
A
41
B
42
C
43
D
44
E
45
F
46
DirectNET Host Communications Programs
6–13
Byte 4 indicates whether the operation is a read or write request. A value of HEX
ASCII 30 is read, HEX ASCII 38 is write.
Byte 5:
Data Type
This byte identifies the type of memory to be accessed. Appendices D–F provide a
complete listing of the data types and memory references for product families.
Bytes 6 & 7:
Starting Address
MSB
The address is the starting point for the data transfer. The data is transferred from
this point forward. For example, to transfer the first 32 X input points from a DL405
PLC the starting address would be V40400. The request would actually obtain
V40400 and V40401 since there are 16 points per V-memory location.
Bytes 6 and 7 define the most significant byte of the ASCII coded memory address.
For example, the reference address for V40400 is 4101. This is obtained by
converting the octal number to hexadecimal and adding 1, the most significant byte
of this value is then decoded into HEX ASCII. The most significant byte would be
HEX 41 or HEX ASCII 3431. Appendices D–F provide complete references for the
addresses used in the various DirectLOGIC PLC families.
Bytes 8 & 9:
Starting Address
LSB
These bytes define the least significant byte of the address obtained in the step
above. So to continue on with our example of reading the first 32 inputs at memory
location V40400 from a DL405 PLC, the reference value for this location would be
4101. The least significant byte of the reference value (01) would be decoded to
3031 in HEX ASCII.
Bytes 10 & 11:
Complete Data
Blocks
Bytes 14 & 15:
Master Station ID
This is the coded number of complete data blocks that should be transferred.
DirectNET can transfer 256 bytes in a single data block. Take the number of bytes
and divide by 256 to obtain the number of complete data blocks. This results in a
valid range of 00 – FF HEX, or 3030 – 4646 HEX ASCII. If you’re not transferring at
least 256 bytes, then this field should be HEX 00 or HEX ASCII 3030.
For example, if you are transferring 200 V-memory locations, you would have the
following: 200 x 2 bytes per location = 400 bytes. 400 bytes / 256 per block =1
complete block, with 144 bytes remaining. For one (01) complete data block, the
value entered for this field would be the HEX ASCII code of 3031.
This is the HEX ASCII coded number of bytes in the last data block. If you did not
have a an even number of complete data blocks, then you had some remaining
bytes. Enter the number of remaining bytes here. The valid range is 00 – FF HEX, or
3030 – 4646 HEX ASCII.
For example above with 144 bytes (or 90 bytes in HEX) the value entered in this field
would be the HEX ASCII code of 3930.
This is the master station address. Since the master station should be address 0 or
1, this field is always HEX ASCII 3030 or 3031 for addresses 0 and 1 respectively.
Byte 16:
End Transmission
Byte 16 always contains the HEX ASCII code for End of Transmission Block. This
field always contains HEX ASCII17.
Bytes 12 & 13:
Partial Data Block
This is a checksum that is used to verify the communications were received without
Byte 17:
any errors. This is calculated by taking the exclusive OR of the bytes between the
Longitudinal
Redundancy Check start of header (SOH) and the end of transmission (ETB) bytes (bytes 2 – 15). If
you’re using ASCII format, then this actually takes two bytes which makes the
header an 18 byte message. The LRC is explained in more detail later in this chapter.
DirectNET Host
Communications Prog.
Byte 4:
Read or Write
DirectNET Host
Communications Prog.
6–14
DirectNET Host Communications Programs
Transferring Data
Data Blocks
The data blocks contain the actual data that is being transferred between the master
and slave station. DirectNET transfers data in full blocks of 256 8-bit bytes, or partial
blocks of less than 256 8-bit bytes. The 256 byte limit does not include control
characters that signal the end of the data. To determine the number of full blocks,
divide the number of bytes by 256. The remainder is the number of bytes in the
partial data block.
Since ASCII mode requires twice as many bytes for the data, you can transfer more
information per request with HEX mode.
Transmission
Sequence
Since the data is transmitted in bytes, it is important to understand how the original
value is separated during transmission. DirectNET uses a simple byte swapping
process where the least significant byte is transferred first. In ASCII mode, the
original data is split into 4-bit units and then converted into 8-bit bytes.
Memory types that only use 1 byte are also treated in the same manner. For
example, a 1-byte memory type would yield 1 byte in HEX mode, but two bytes in
ASCII mode (4 bits converted into 2, 8-bit bytes).
The following diagram shows the differences between HEX and ASCII modes.
Transfer 200 V-memory
Locations
V1400 (octal)
MSB
LSB
V1650 (octal)
HEX Mode
ASCII Mode
V1400 (octal)
MSB
V1400 (octal)
LSB
2, 8-bit bytes per location
MSB
1
2
3
4
4, 8-bit bytes per location
LSB
3
MSB
4
(200 x 2) / 256 = 1 full block )
(200x2) – (1 x 256) = 144 byte partial
LSB
1
2
(200 x 4) / 256 = 3 full blocks )
(200x4) – (3 x 256) = 32 byte partial
6–15
DirectNET Host Communications Programs
The HEX ASCII control codes that indicate the beginning and end of data blocks are
used to manage the data transfer. Start of Text (STX) indicates the beginning of a
data block. If there are several blocks, all but the last block will terminate with the End
of Block (ETB) code. The last block always ends with End of Text (ETX). All transfers
also include an LRC checksum. ( For a data block, the checksum is the exclusive OR
of all bytes between the STX and ETB/ETX characters. The LRC is discussed in
more detail later.)
The following diagram shows the communication sequence.
STX
Data Block
ETB or ETX
LRC
Hexadecimal ASCII
code for STX
Byte 1
up to 256 Data Bytes
Byte n
Byte n+1
02
lsb msb ...... lsb msb
17 or 03
Checksum
Data
HEX ASCII control code for ETB (17)
or ETX (03)
DATA
LRC
DirectNET Host
Communications Prog.
Start of Text, End
of Block, End of
Text
DirectNET Host
Communications Prog.
6–16
DirectNET Host Communications Programs
Calculating the Header Checksum
Longitudinal
Redundancy
Check
The LRC yields a checksum which is used to verify the communications are being
received without errors. For a header, this checksum is calculated by taking the
exclusive OR of all bytes between the Start of Header and End of Transmission
(ETB). For a data block, the checksum is the exclusive OR of all bytes between the
STX and ETB/ETX characters. To take the exclusive OR, just convert the HEX
values to binary and then examine the bits. For each bit position, an even number of
‘1’s results in a checksum value of 0. An odd number of ‘1’s results in a checksum
value of 1. Here’s an LRC calculation example based on the values used in the
discussion of the header.
HEX ASCII Coded Representation
Byte:
1
2, 3
4
5
6, 7
8, 9
10, 11
12, 13
14, 15
16
17(18)
01
3034
30
31
3431
3031
3031
3930
3031
17
08
3038
SOH
Target
Slave
Read
or Write
Data
Type
Data
Address
MSB
Data
Address
LSB
Number
Complete
Blocks
Bytes
in Last
Block
Master
ID
ETB
LRC
Byte
Target slave:
HEX
ASCII
Value
HEX
ASCII
Binary Representation
B7
B6
B5
B4
B3
B2
B1
B0
128
64
32
16
8
4
2
1
(byte 2)
(byte 3)
30
0
0
1
1
0
0
0
0
34
0
0
1
1
0
1
0
0
Read or write:
(byte 4)
30
0
0
1
1
0
0
0
0
Data Type:
(byte 5)
31
0
0
1
1
0
0
0
1
Data address MSB:
(byte 6)
(byte 7)
34
0
0
1
1
0
1
0
0
31
0
0
1
1
0
0
0
1
(byte 8)
(byte 9)
30
0
0
1
1
0
0
0
0
31
0
0
1
1
0
0
0
1
(byte 10)
(byte 11)
30
0
0
1
1
0
0
0
0
31
0
0
1
1
0
0
0
1
(byte 12)
(byte 13)
39
0
0
1
1
1
0
0
1
30
0
0
1
1
0
0
0
0
Master address:(byte 14)
(byte 15)
30
0
0
1
1
0
0
0
0
31
0
0
1
1
0
0
0
1
Total Number of “1s”
0
0
14
14
1
2
0
6
Even (E) or Odd (O)
E
E
E
E
O
E
E
E
Exclusive OR Results:
0
0
0
0
1
0
0
0
Data address LSB:
Complete blocks:
Bytes in last block:
Hexadecimal Value
0
8
HEX ASCII Code
30
38
DirectNET Host Communications Programs
6–17
HEX Mode: 1 byte
LRC Checksum
Decimal 8
0 0 0 0 1 0 0 0 1 byte
7
0
16
17
17
08
ETB
LRC
ASCII Mode: 2 bytes
16
17 & 18
17
3038
ETB
LRC
Calculating the Data LRC
You should always calculate the LRC when either writing data to a slave or reading
data from a slave. Note, during a read command slave stations will calculate their
own LRC to be verified by the receiving device. However, you must calculate the
value for LRC verification.
The LRC is included in the header and data transmissions. For a data block, the
checksum is the exclusive OR of all bytes between the STX and ETB/ETX
characters. (The example program in Appendix C shows how to do this in a BASIC
program.)
NOTE: You only have to verify the checksum when you are creating your own
DirectNET communications programs. If the master is a DirectLOGIC PLC with a
communications interface, RLL instructions are used for the communication
program and checksum verification is done automatically.
LRC Example for
HEX and ASCII
Transfers
HEX Mode
STX 21
32
03
51 ETB/ETX LCR
21 = 0010 0001
This example shows
how to calculate the
LRC for the same data
being transferred in
either HEX or ASCII
mode.
32 = 0011 0010
03 = 0000 0011
51 = 0101 0001
0100 0001 = 41 LCR
ASCII Mode
STX 32
31
33
32
30
33
35
31 ETB/ETX LCR
32 = 0011 0010
31 = 0011 0001
33 = 0011 0011
32 = 0011 0010
30 = 0011 0000
33 = 0011 0011
35 = 0011 0101
31 = 0011 0001
0000 0101 = 3035 LCR
(0000 0101 = 05 = 3035 HEX ASCII)
DirectNET Host
Communications Prog.
From the table the checksum value is decimal 8. The checksum is contained in byte
17 of the header, but the actual value that is included depends on which mode of
operation you are using. In HEX mode, this would be HEX 08. If you’re using ASCII
mode, then the value would be 3038 and the LRC now requires two bytes (17 and
18). The following diagram shows the differences in a HEX or ASCII mode LRC.
DirectNET Host
Communications Prog.
6–18
DirectNET Host Communications Programs
Ending the Request
End of
Transmission –
ETB
When the last data block has been transferred and acknowledged, the End of
Transmission (EOT) character is sent. The master station must always end the
communication by sending an EOT (HEX ASCII 04). The following diagram shows
the EOT format.
HEX ASCII
code for EOT
EOT
EOT
Byte 1
04
Master to Slave
Data Transfer
Summary Sheet
Host Master Station
Slave Station
N
ENQ
Offset Target Address
ENQ
4E 21 05
N
Offset Target Address
ACK
ACK
SOH
4E 21 05
Target Address
HDR
Write
Function
Starting Address
Whole Blocks
Remaining Bytes
Host Number
ETB
LRC
01 3031 38 37 3030 3134 3031 3045 3030 17 LRC
ACK
ACK
06
STX
DATA
Full Data Block
(256 bytes)
ETB
LRC
02
Date
17
LRC
ACK
ACK
ACK
ACK
06
STX
DATA
Last Data Block
ETX
LRC
02
Date
03 LRC
06
EOT
EOT
04
DirectNET Host Communications Programs
6–19
Timeouts
DL405 Timeouts
The network communications generally operate very quickly and without problems.
However, as with all things, problems can occur. Timeouts occur when either the
master or slave does not receive a response to a communication within a certain
period of time. There are two timeout possibilities.
S Slave timeout – this occurs when the slave does not respond within a
specified time. When the slave times out, you must send an EOT from
the host to terminate the communication
S Master timeout – this occurs when the slave station does not receive the
complete communication from the master within a specified time. The
slave station will send an EOT to signal that the communications have
been terminated. The master must also send an EOT back to the slave
to acknowledge the termination. (This allows the next communication to
begin.)
The following tables provide the maximum times that DirectLOGIC products will
wait for a communication before entering a timeout condition.
Communication Segment
Master sends ENQ → Slave sends ACK
800
Master receives ACK → sends Header
800
Slave receives Header → sends ACK/NAK
(
(Destination
– write is slave, read is master))
Master receives ACK → Data is transferred
Destination receives Data → sends ACK/NAK
Source receives ACK/NAK → sends EOT
DL205 Timeouts
within (ms)
Communication Segment
2000
20000
20000
800
within (ms)
Master sends ENQ → Slave sends ACK
800
Master receives ACK → sends Header
800
Slave receives Header → sends ACK/NAK
(
(Destination
– write is slave, read is PLC))
Master receives ACK → Data is transferred
Destination receives Data → sends ACK/NAK
Source receives ACK/NAK → sends EOT
2000
20000
20000
800
DirectNET Host
Communications Prog.
Timing Considerations
DirectNET Host
Communications Prog.
6–20
DirectNET Host Communications Programs
DL305 Timeouts
Communication Segment
Master sends ENQ → Slave sends ACK
800
Master receives ACK → sends Header
800
Slave receives SOH → waits for Header LRC
300 baud
1200 baud
9600 baud
19.2K baud
2670
670
670
670
Slave receives Header → sends ACK/NAK
2000
(Destination – write is slave, read is PLC)
Master receives ACK → Data is transferred
Destination receives Data → sends ACK/NAK
300 baud
1200 baud
9600 baud
19.2K baud
Source receives ACK/NAK → sends EOT
Managing
Timeouts
Communication
Retries
Delays
within (ms)
20000
33340
8340
8340
8340
800
All communications finish with an EOT being sent from the master station. Even if
the slave station sends an EOT to signal that it has aborted the communication, the
master still must send an EOT to enable the slave to accept a new enquiry.
If you are reading information from a slave and the LRC calculated in your program
does not match the slave station LRC, you do not have to abort the communication
with an EOT. Instead, send a NAK which will signal the slave to re-transmit the data.
If you send an EOT you must restart the entire request.
The slave stations send NAKs to signal the master to try sending header or data
packets again. The master can either re-transmit a maximum of three times, or, send
an EOT to restart the request.
Each portion of the communication requires a delay to allow the PLC to process the
information. If you send data without allowing for the delay, the communication may
be ignored (which causes a timeout), or the parity check will fail (which causes a NAK
response). The following table provides delay times for the DirectLOGIC
products.
Information to Process
Delay (ms)
ACK of data packets,
headers
1
All other ACKs, headers,
EOTs
1
NOTE: The communication interfaces have delay switches that increase this delay
time. If those delays are selected, add the appropriate times to the figures shown
here.
DirectNET Host Communications Programs
6–21
Start the Network
Once you’ve created the communications program, you can start the network.
Chapter 7 provides information concerning network operation and troubleshooting.
Appendix C provides an example of a hosted network.
DirectNET Host
Communications Prog.
What part of the manual should you use next?
Was this manual useful for you? yes no
Thank you for your participation!

* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project

Download PDF

advertisement