Why Use the Standard Driver Software?
Compatible Hardware and Software
Overview of the F
Software Considerations
Installing the Standard Driver Software
Chapter Objectives
What the P
What's on the Diskette
Installing the Standard Driver Hardware and Software
Planning Y
Chapter Objectives
Include Files
Overview of the F
P
rogramming Considerations
Using the F
Chapter Objectives
Using Open_StdDrv()
Communicating on DH485 with the 6001F2E Standard Driver
Using Appl_StdDrv()
Using Send_StdDrv()
Using Get_ErrMsg()
Using Close_StdDrv()
Compiling, Linking, and Configuring Your Application Program51 . . .
Chapter
Compiling and Linking Y
Configuring Y
Application P
Sample P
PLC2 Unprotected R
PLC2 Unprotected W
Diagnostic L
Diagnostic Counter R
Diagnostic Status
Diagnostic Counter R
Specifying Message P
Chapter Objectives
F
Message P
Supported Command Set
Diagnostic Counters R
Diagnostic L
Diagnostic R
Diagnostic Status
Unprotected R
Install the 6001-F2E Standard Driver software
Communicate with DH-485 stations via the 6001-F2E Standard Driver
software
Use this manual and the 6001-F2E Standard Driver software if any of
your application programs require information from devices such as the
SLC-500 programmable controller. We assume you are familiar with the
DOS operating system and C programming language.
See the following publications for information about communicating on
the DH-485 network.
Refer
to this manual
PC DH-485 Interface Module Installation
Data (publication 1784-2.23)
Data Highway/Data Highway Plus
Protocol and Command Set User
Manual (publication 1770-6.5.16)
The Standard Driver Software (cat. no. 6001-F2E) for the 1784-KR
Interface Module lets you communicate directly to SLC-500
programmable controllers and other devices on the DH-485 network. You
use a standard set of function calls to communicate with DH-485 stations.
These function calls let you define your own message packets or request
pre-defined message packets included in the software. See page 4-2 for
more information about the message packets.
You can use the following hardware devices with the 6001-F2E Standard
Driver software:
1784-T35 Plant Floor Terminal
1784-T50 Industrial Terminal
6120, 6121, and 6122 Industrial Support Computers
IBM PC/XT and PC/AT
Compaq Deskpro 286
Compaq Portable II and III
If your computer is not listed above, consult your local Allen-Bradley
sales office for compatibility information.
You can use the following with the 6001-F2E Standard Driver software:
If
you use this programming deviceUse this operating system
1784-T50 programming terminal
IBM PC/XT
programming terminal
1
If you are using a 1784-T50 that has DOS version 2.1
current version of Allen-Bradley DOS
, PC/AT, or IBM-compatible
1
Allen-Bradley DOS version 3.21
DOS version 3.0 or later (Use the DOS version
included with the programming terminal)
1 or earlier
, you need to purchase the
1-1
Chapter 1
Product Overview
Overview of the Function Calls
The 6001-F2E Standard Driver Software consists of a library of C
programming language function calls that let your computer communicate
with nodes on the DH-485 network. Table 1.A lists these commands:
T
able 1.A
6001-F2E
If you want to
perform initialization functions (required
before any communication can take
place)
transmit data over the DH-485 network
to a DH-485 station
release all resources and services
before the application program
terminates
Standard Driver Software Commands
Use this function call
Open_StdDrv
Send_StdDrv
Close_StdDrv
See chapter 4 for more information on the function calls.
1-2
Chapter 1
Product Overview
Software Considerations
Important information about the 6001-F2E Standard Driver software for
the 1784-KR Interface Module is listed below:
the 6001-F2E driver does not support unsolicited messages
the 6001-F2E does not support multiple outstanding commands (you
must receive the reply from your command before sending another
command)
the 6001-F2E supports the large memory model version of Microsoft C
and Borland Turbo C only
the 6001-F2E driver does not respond to a diagnostic status command
sent to itself, but responds to diagnostic status commands sent from
another computer
the 6001-F2E driver does not return a local error code if the KR detects
a node address on the network the same as its own. The station that had
the address first stays on-line; the other station goes off-line, so check
for duplicate addresses in this situation,
if you incorrectly format messages to be sent by the Standard Driver
software, a timeout condition occurs in the application. Since there is
no error code indicating an incorrect message format, check the
message format first when the application software times out with a
timeout error code
the 6001-F2E does not support off-link messages (messages sent across
a bridge to another network)
the 6001-F2E supports applications that communicate with a single
1784-KR only
1-3
Chapter
2
Installing the Standard Driver Software
Chapter Objectives
What the Package Includes
In this chapter, you learn about:
what the Standard Driver package includes
the contents of the Standard Driver diskette
how to install the Standard Driver Software
You have one of these two packages:
Cat.
No.
6001–F2E
1747-F2E
Each package contains:
one User’s Manual (publication 6001-6.5.5)
one 5-1/4” diskette and one 3-1/2” diskette (use the appropriate diskette
for your system)
software license
Product Description
Stand-alone Standard Driver software for the
1784-KR
Standard Driver software bundled with the 1784-KR
hardware
If you ordered the 1747-F2E, you received a 1784-KR board in addition
to the items listed above.
2-1
Chapter 2
Installing the Standard Driver Software
What’s on the Diskette
The Standard Driver diskette contains the following types of files:
linkable large memory model standard driver library files
application library files
example application files
Standard Driver Library Files
Use the following files to build a linkable large memory model
application using the Standard Driver.
This
file
L_MSKR.LIB
L_TCKR.LIB
STDDRV.H
KRDEFS.H
START485.EXE
Contains
a large memory model Microsoft v5.1 compatible 6001-F2E
Standard Driver library module
a large memory model Borland v2.01 compatible 6001-F2E
Standard Driver library module
definitions and declarations required to compile a 6001-F2E
Standard Driver application
the 6001-F2E Standard Driver start-up and initialization program.
Run the START485.EXE to initialize the 1784-KR before you run
your application
Application Library Files
The following files contain application functions libraries that let you use
pre-defined support routines (Application Libraries). Use these in
applications using the basic command set in table 4.B on page 4-2.
This
file
L_MSAPP.LIB
L_TCAPP.LIB
Contains
a large memory model Microsoft v5.1 compatible application library
module
a large memory model Borland v2.0 compatible application library
module
2-2
Chapter 2
Installing the Standard Driver Software
Example Files
The following files contain working 6001-F2E Standard Driver
application examples:
This
file
Contains
Installing the Standard Driver
Hardware and Software
F2EDIAG.C
F2ESLC.C
SCREEN.H
diagnostic routines
unprotected read and unprotected write routines
definitions and declarations required to compile F2EDIAG.C or
F2ESLC.C
This section tells you how to install the Standard Driver hardware and
software.
Installing the Hardware
To install the Standard Driver hardware:
1.Set the 1784-KR memory address switches and jumper settings that
are compatible with your computer system (See the 1784-KR
Installation Data, publication 1784-2.23, for instructions on setting
these switches.)
2.Record these addresses on a piece of paper. You will need them
when you configure the software.
2-3
Chapter 2
Installing the Standard Driver Software
Installing the Software
To install the Standard Driver software:
1.Create a working directory in your computer’s hard disk (C:\F2E, for
2.Put the disk containing the Standard Driver files in disk drive A:>
3.Copy all the files from the disk to that directory
This completes the installation procedure. The next chapter helps you
plan your application program.
example). Use this directory to build your application program(s).
(We use drive A:> as a default.)
Copy A:*.* C:\F2E).
(
2-4
Chapter
3
Planning Your Application Program
Chapter Objectives
Include Files
This section guides you through the process of planning an application
program. It contains the following:
include files you need to put in your program
function calls
programming considerations
The include files contain declarations for the driver type you are using.
Define them at the top of your application program. The 6001-F2E
Standard Driver uses the following include files:
KRDEFS.H
STDDRV.H
Important: In addition to including header files in your application, you
need to link with an appropriate Standard Driver and Application Library
file (whether you are using the Application Library or not).
If you use multiple files, place KRDEFS.H and STDDRV.H in the main
file. Only one source per executable can reference each include file. If
additional source files within an executable reference the Standard Driver
software, you must do the following:
duplicate KRDEFS.H and STDDRV.H under different names
delete the following lines from the duplicate KRDEFS.H:
int max_umsg = Max_Umsg;
int max__smsg = 16;
delete from the duplicate STDDRV.H all lines beginning from the first
occurance of /* ..... */ under the “Prototype” heading to the
end of the file
Use these edited versions in all remaining source files that reference the
6001-F2E Standard Driver software.
3-1
Chapter 3
Planning an Application Program
Overview of the Function Calls
Function calls let your application program communicate with devices on
the DH-485 network:
This
Function Call
Open_StdDrv()
Appl_StdDrv()
Send_StdDrv()
Get_ErrMsg()
Close_StdDrv()
Lets Y
ou
initialize the 6001-F2E Standard Driver. Use this function call in
every
program you write.
use predefined support routines (Application Library) in
applications that use the basic command set. See page 4-2 for a
list of these commands.
format commands not provided in the Application Library
you format message packets when communicating with
token-passing or slave-only devices.
retrieve an ASCII string that describes a network message error
end communication. Use this function call in
write.
every
. It lets
.
program you
Important: When you write your program, you must always start with
Open_StdDrv() and end with Close_StdDrv(). The middle of your
program will consist of Appl_StdDrv() or Send_StdDrv() or a
combination of both. Use the Send_StdDrv() function call to format
commands not supported by the Application Library routines. (See table
4.B on page 4-2 for a list of these commands.)
Programming Considerations
Your disk contains example programs (F2EDIAG.C and F2ESLC.C) you
can use to test communication on the DH-485 network. (See appendix A
for additional program examples.)
The next chapter for the format and parameters for each function call.
Keep the following considerations in mind when you write your
application program:
Use Borland Turbo C (v2.01 or later) or Microsoft C (v5.0 or later)
Whether you use only Appl_StdDrv() routines or Send_StdDrv()
routines, you must always link the following:
If
you are using this
Borland Turbo C (v2.01)
Microsoft C (v5.0)
Link these files
L_TCKR.LIB
L_TCAPP.LIB
L_MSKR.LIB
L_MSAPP.LIB
3-2
Using the Function Calls
Chapter
4
Chapter Objectives
Using Open_StdDrv()
This chapter shows you how to use each of the function calls. It includes
the format and parameters for each function call.
The Open_StdDrv() function call initializes the 6001-F2E Standard
Driver. To open the Standard Driver, use the following format and
parameters:
Format for Open_StdDrv()
The Open function call is shown below:
status = Open_StdDrv(device,0,0,0,
(unsol_msg *)NULL,
0,0,0);
Parameters for Open_StdDrv()
Assign the parameters in Table 4.A:
T
able 4.A
Assigning
ParameterTypeDescription
device[ ] = “KR:0”
(unsol_msg *)NULL,
0N/A
When the Open_StdDrv() function is called, a status value is returned
indicating whether the operation was successful or unsuccessful. Normal
completion is 1. A value other than 1 indicates that an error occurred.
See Appendix D for a list of error codes.
Parameters to Open Communication
char
struct
Assigns a driver type “KR:” and communication channel “0”. The 6001-F2E
Standard Driver supports one 1784-KR communication channel.
This is a null pointer for this release.
These parameters are ignored, but you still need to include them in the
function call. Type in a zero for each ignored parameter
.
4-1
Chapter 4
Writing Your Own Application Program
Communicating on DH-485 with
the 6001-F2E Standard Driver
Using Appl_StdDrv()
After you have initialized the Standard Driver with the Open_StdDrv()
function call, you are ready to communicate. You can use the
Appl_StdDrv() function call (Application Library) or the Send_StdDrv()
function call or a combination of both. Use the SendStdDrv() function
call to format commands not supported by the Application Library. See
table 4.B for a list of commands supported by the Application Library.
The Appl_StdDrv() function formats DH-485 messages for the basic
command set and transmits them over the DH-485 network. Use the
Appl_StdDrv() with the selected PLC application symbol and
Appl_StdDrv() message block data structure. The application symbols
and the message block data structure are defined in the STDDRV.H header
files. Use the following format and parameters:
Format for Appl_StdDrv()
The Appl_StdDrv() function call is shown below:
status = Appl_StdDrv(SYMBOL, SD_FB *);
Parameter
TypeDescription
SYMBOLintidentifies
SD_FBstruct
initializes the DH+ function block (see table 4.C)
the support routine symbol (see table 4.B)
See appendix D for return status values for the Appl_StdDrv()
function.
Parameters for Appl_StdDrv()
Table 4.B below shows the available functions (in the Application
Library) you can use with Appl_StdDrv(). Table 4.C shows the
Appl_StdDrv() message block data structure:
T
able 4.B
6001-F2E
T
Diagnostic loop back testing
Read diagnostic counters
Read diagnostic status
Reset diagnostic counters
Basic command set unprotected read
Basic command set unprotected write
Support Routines
o do this
Specify this
PLC_DLB
PLC_DCR
PLC_DS
PLC_RC
PLC_UPR
PLC_UWR
4-2
Refer to Appendix B for each of the available Application Library
routines.
T
able 4.C
Appl_StdDrv()
VariableTypeDescription
Message Block Data Structure
Chapter 4
Writing Your Own Application Program
DHP_MSG.dev = device;
DHP_MSG.stat = &io_stat[0];unsigned int
DHP_MSG.L_R = Loc_Rem;
DHP_MSG.dst = &destination; unsigned char The DH-485 destination address. The destination variable is the DH-485
DHP_MSG.dta = &dt_addrunsigned intThe data table address. Depending on the routine, the dt_addr variable is a
char
int
The device variable indicates to the Standard Driver the communication
interface and its channel. Set this variable to KR:0.
The io_stat variable serves two purposes. When Application Library routines
are called, they return status before any type of reply is received from the
remote device.
When the Appl_StdDrv() successfully initiates a request to send a message
(status = 1), io_stat[0] is reset to 0. When a reply message is received or a
reply timeout occurs that matches the original request, io_stat[0] is set to a
value greater than 0. Normal completion is 1. If io_stat[0] is normal,
io_stat[1] will contain the length of the reply data buf
If io_stat does not equal 1, an error occurred. The format is as follows:
The low byte (EXT STS) of io_stat[0] contains local errors, such as timeout.
The High byte (STS) of io_stat[0] contains DH-485 errors. If the high byte of
io_stat[0] equals F0 Hex (indicating the extended DH-485 status), the low
byte if io_stat[0] will contain the extended DH-485 status value. See
appendix D for more information on error messages. See table 4.F for
examples of STS and EXT STS bytes in io_stat[0].
Set this variable to 0.
address where you want your message to be sent on the DH-485 network.
two byte value or string describing the data table address where data is to be
read from or written to.
fer.
DHP_MSG.len = size;
DHP_MSG.buf = &d_buf
DHP_MSG.T
O = timeout;unsigned intThe timeout variable is the number of seconds that you want to wait for a
f[0];
int
unsigned char
or
int
When reading data, the size variable indicates how many data bytes are to
be read. When writing data, the size variable indicates how many bytes
should be copied from the data buf
The application data buf
formats. If you are using byte values, d_buff may be defined as a char array
the size variable is defined as a one-to-one relationship. If you are using
signed integers, data is automatically stored in byte swapped format, the size
value is defined as a two-to-one relationship.
reply.
fer
fer and written to the remote station.
. The application data may take on several
Important: If you are communicating to an SLC-500 using the
unprotected read or unprotected write commands, create Data File 9 in the
SLC-500. The SLC-500 uses this file for DH-485 communication. The
data table address (defined as dt_addr in the Appl_StdDrv() function) will
4-3
,
Chapter 4
Writing Your Own Application Program
be interpretted by the SLC-500 as a logical offset (in words) into Data
File 9. See the SLC-500 Advanced Programming Software Manual,
chapter A3, for more information on the SLC-500 memory organization.
Using Send_StdDrv()
If you do not wish to use the commands supported by the Application
Library, use the Send_StdDrv() function to send user-formatted messages.
The Send_StdDrv() function call transmits data over the DH-485 network
to a DH-485 station. Depending on your application, you can use the
Send_StdDrv() function call two ways. You can:
communicate with token-passing DH-485 devices (such as the
SLC-500)
communicate with slave-only DH-485 devices
(See appendix B for more information on message packet formats for the
Send_StdDrv() function call.)
Any transmission that does not complete normally is aborted by a timeout
or local error code indicating the problem. See appendix D for a list of
error codes. Use the following format and parameters:
Use the Send_StdDrv() function call to send user-formatted messages.
Parameters for Send_StdDrv()
Assign the parameters in Table 4.D:
T
able 4.D
Assigning
ParameterTypeDescription
Parameters to Send Data
Chapter 4
Writing Your Own Application Program
device[] = “KR:0”
io_stat[2];
cmd_buff[...]
char
unsigned int
unsigned char The cmd_buff parameter is the buffer containing your message to be sent to the remote
The device parameter should coincide with the same device used in the Open_StdDrv()
function (Set this value to KR:0.)
The io_stat variable serves two purposes. When standard driver routines are called, they
return status before any type of reply is received from the remote device.
When the Standard Driver successfully initiates a request to send a message (status = 1),
io_stat[0] is reset to 0. When a reply message is received or a reply timeout occurs that
matches the original request, io_stat[0] is set to a value greater than 0. Normal completion is
1.
If io_stat does not equal 1, an error occurred. The format is as follows:
The low byte (EXT STS) of io_stat[0] contains local errors, such as timeout. The high byte
(STS) of io_stat[0] contains DH-485 errors. If the high byte of io_stat[0] equals F0 Hex
(indicating the extended DH-485 status), the low byte if io_stat [0] will contain the extended
DH-485 status value. See appendix D for more information on error messages. See table
4.F for examples of STS and EXT STS bytes in io_stat[0].
station. Use the following format:
LEN TYP DST SRC CMD STS TNS TNS DA
The LEN field contains the entire packet length, including LEN. The TYP field is the
message type. Set this value to 0 or 5, depending on the message type. The DST field is the
DH-485 destination where your message is sent. The SRC field is the local 1784-KR DH-485
address. This field can be set to 0. See appendix B for definitions of each field.
TA
pass_thru = 1;
pass_thru = 0;
reply_buf
timeout = 5;unsigned int
0, 0
f[...];
int
unsigned char The reply_buff parameter tells the driver where to put a reply message to your application.The
N/A
The pass_thru parameter is a reply option for the Standard Driver. When pass_thru is set to
1, the entire reply message (the header and the data you requested) is placed in your buf
When the pass_thru parameter is set to 0, only the data you requested (not the header) is
fer
placed in your buf
reply message is copied into your buf
LEN TYP DST SRC CMD STS TNS TNS DA
The timeout parameter is the number of seconds your application waits for a reply message.
Parameters 7 and 8 are not used, but you still need to include them in the function call. T
in a zero for both parameters.
. The length is returned in io_stat[1].
fer using the following format:
TA
See Appendix D for return status values for the Send_StdDrv()
function.
fer.
ype
4-5
Loading...
+ 39 hidden pages
You need points to download manuals.
1 point = 1 manual.
You can buy points or you can get point for every manual you upload.