Allen-Bradley ControlNet KT Emulation Dual-port Interface Specification (Cat. No.
Important User Information Because of the variety of uses for the products described in this publication, those responsible for the application and use of this control equipment must satisfy themselves that all necessary steps have been taken to assure that each application and use meets all performance and safety requirements, including any applicable laws, regulations, codes and standards. The illustrations, charts, sample programs and layout examples shown in this guide are intended solely for example.
Preface Preface Read this preface to familiarize yourself with the rest of the manual.
P-2 Preface What You Receive with This Package Publication 1784-6.2.4 - September 1997 As you read this manual, you need to know that: This: Refers to this: KTCX card 1784-KTCX card BA Base address of the KTCX card as installed. DP ADDR The dual-port address. It is located at 03000h (3000:0000h) beyond the installed address of the KT module. DP ADDR :0800h to :0806h Memory-mapped hardware addresses. h hex code host Personal computer or workstation of driver.
Preface Allen-Bradley Support 3 Allen-Bradley offers support services worldwide, with over 75 Sales/Support Offices, 512 authorized Distributors and 260 authorized Systems Integrators located throughout the United States alone, plus Allen-Bradley representatives in every major country in the world.
P-4 Preface Notes: Publication 1784-6.2.
Table of Contents Overview of the KTCX Card Environment What Your Driver Must Do at Start-up How Your Driver Operates the KTCX Card Chapter 1 What This Chapter Covers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1-1 ControlNet Network Environment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1-1 The ControlNet System Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .1-1 Node Addressing and Node Table . . . . . . . . . . . . . . . . .
toc–ii Table of Contents – ControlNet KT Emulation Dualport Interface Specification Receive Examples. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-8 Receive Data Memory Map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .3-9 Example Code for Polled and Interrupt Messaging Defined Statements for the KTCX Card Publication 1784-6.2.4 - March 1997 Appendix A Network Configurations for Polled and Interrupt Messaging. . . . . . . . . . . . . .
Chapter 1 Overview of the KTCX Card Environment What This Chapter Covers ControlNet Network Environment To build a driver that handles all the conditions of your system, you must be familiar with: • ControlNet Network Environment • Hardware and Software Interface of the KTCX Card • Data Flow From Application to KTCX Dual-port Interface to Network • KTCX Card Requirements and Operating States Read the following sections before building your driver: • The ControlNet System Overview • Node Addr
1-2 Overview of the KTCX Card Environment Figure 1.1 ControlNet Network Overview ControlNet Network Host PC with ISA/EISA Bus Interface KTCX Card ControlNet Tap 1771 ACN I/O Adapters ControlNet Tap 1794 ACN Flex I/O Adapters ControlNet Tap PLC-5C Processors ControlNet Tap ControlNet Taps: 1786-TPR 1786-TPYR 1786-TPS 1786-TPYS Node Addressing and Node Table The KTCX does not maintain an active node table. However, to accommodate existing applications the KTCX emulates an active node table.
Overview of the KTCX Card Environment 1-3 Control and Configuration of Programmable Logic Controllers To configure a programmable controller, you must refer to the applicable processor manual that came with the programmable controller. This processor manual, along with the controller’s programming manual, shows you how to control and program your device. Off-link Messaging The KTCX does not support off-link connections within the ControlNet network environment.
1-4 Overview of the KTCX Card Environment Reserved Sections for System Memory and Mailboxes The KTCX card reserves sections of the dual-port’s 2K memory to use as “mailboxes.” These mailboxes hold and transfer packets of data, commands, and status information for both the KTCX card and the application running on the host. Important: You cannot mix 8-bit and 16-bit cards within a 64K segment boundary.
Overview of the KTCX Card Environment 1-5 Selected Base Address The KTCX dual-port is 16K in size. See the 1784-KTCX Installation Manual (Pub. 1784-5.20) for all the available dual-port and I/O addresses and their respective settings. The KT Emulation dual-port location is the same as the 1784-KT. For example: if the dual-port address is at 0D000h, then the KT Emulation dual-port address starts at 0D300h.
1-6 Overview of the KTCX Card Environment Operating States The KTCX card has five operating states: reset, off-line, lonely, listen-only and on-line. Reset The card is on the network and waiting for start-up procedure to be placed on-line. Off-Line The initial state of the KTCX card at start-up must be off-line. In the off-line mode, the KTCX card is not on the ControlNet network and can neither send nor receive messages nor build the node table.
Overview of the KTCX Card Environment Transition A 1-7 Description The initialization code (C3,...,0) has been placed in the dual-port and offset 802h is set to 1. KT emulation is placing the card in listen-only mode. The card is now waiting for the keeper to bring it on-line. The KT_alive flag is continually being written with a 3 every 10 ms. The card is transitioning to the on-line state and the KT_alive flag is being set to 2. The KT_ alive flag is continually being written with a 2 every 10 ms.
1-8 Overview of the KTCX Card Environment Notes: Puiblication 1784-6.2.
Chapter 2 What Your Driver Must Do at Start-up What This Chapter Covers This chapter explains the start-up requirements of the KTCX card. Your driver must: Using the KTCX Memory-Mapped Hardware • Use the KTCX Memory-Mapped Hardware • Initialize the KTCX Card Before you begin building your driver, you must be familiar with the KTCX card's memory-mapped hardware. There are seven memorymapped addresses, but byte :0800h is reserved. The KTCX maps the dual-port just like the 1784-KT.
2-2 What Your Driver Must Do at Start-up :0011h :0012h Reserved KTCX_alive --STAT :0013h KTCX_dupe_node STAT :0014h KTCX_off_KTCX CMD :0015h KTCX_stopped_flag :0016h KTCX Module State ➀ ➁ STAT --02h = KTCX is functioning 00h = KTCX address Valid 01h = KTCX duplicate found 01h = shutdown KTCX Note: First write 00h to byte :0015h. FFh = KTCX stopped --W INI N/A N/A R/W See KTCX Alive section in chapter one.
What Your Driver Must Do at Start-up 2-3 Usage With Interrupts The KTCX, by default, is set up to be poll operated even if the card has been set up to interrupt the host. Bits 0 and 1 at byte offset 801h must be set to configure the card for interrupts. Table 2.B show you how to set bits 0 and 1 to in order to configure your card to meet your specifications. Table 2.
2-4 What Your Driver Must Do at Start-up Notes: Publication 1784-6.2.
Chapter 3 How Your Driver Operates the KTCX Card What This Chapter Covers General Communication Configurations To make sure that each packet of information gets to its proper destination without error, your driver needs to know how to correctly operate the KTCX card.
3-2 How Your Driver Operates the KTCX Card Typical Communications Methodology To send data you must: • Build the data packet. • Send the data packet. • If expecting a reply, follow the receive data methodology when the reply arrives. To receive data you must: • Receive an interrupt from the KTCX card if using interrupts, or monitor receive mailboxes if not. • Copy the packet from the Receive Mailbox. • Return the application to the mainstream.
How Your Driver Operates the KTCX Card 3-3 Important: The mailbox is in an invalid state if both the Access Request and the Data Valid bytes show opposing values (one shows 00h and the other 01h). Reading and Writing Access Request and Data Valid Flags. The order in which you read these flags must be as follows. To read access request and data valid flags: 1. Read the Access Request byte (0080h for sending or 0480h for receiving). 2. Read the Data Valid byte (0081h for sending or 0481h for receiving).
3-4 How Your Driver Operates the KTCX Card Send Mailbox The dual-port’s send mailbox (bytes: 0082h - :047Fh) can hold up to 1021 bytes. However, you must refer to the DF1 Protocol and Command Set (Pub. 1770-6.5.16) for the exact size requirements of packets for each message type.
How Your Driver Operates the KTCX Card 3-5 6. The KTCX card takes the packet and sets the Send Data Valid and Send Access Request bytes to 01h. 7. The KTCX card transmits the packet. 8. The KTCX card receives the response packet. 9. The KTCX card checks the receive mailbox. 10. The KTCX card places the response into the receive mailbox and then resets the Receive Access Request and Receive Data Valid bytes to 01h. The host has access to the receive mailbox. 11.
3-6 How Your Driver Operates the KTCX Card Send Data Memory Map Refer to Table 3.C to determine the use of each dual-port address as you send packets. Table 3.E Send Data Memory Map Byte Description Function1 Contents = Meaning Typical Access 2 KTCX . . . . . Host :0080h Send Access Request STAT 00h = KTCX control 01h = host control R/W . . . .R/W :0081h Send Data Valid STAT 00h = KTCX control 01h = host control R/W . . .
How Your Driver Operates the KTCX Card Receive Mailbox 3-7 To receive packets, your driver must check to see that the Receive Access Request byte (0480h) and the Receive Data Valid byte (0481h) indicate that the mailbox is available to it (shown by 01h in both bytes). Then your driver must copy the packet from the dualport’s receive mailbox (bytes 0482h - 07EFh). This mailbox can hold up to 877 bytes.
3-8 How Your Driver Operates the KTCX Card Polled In the standard KTCX polling procedure the card can transmit around 50 messages per second. To have a faster transmission rate, the host to KTCX interrupt word located at offset 3FFCh should be written to after the send flags have been set. This should be done on a per message basis. Interrupt The KTCX interrupt word is at offset 3FFCh in the dual-port.
How Your Driver Operates the KTCX Card 3-9 Receive Packet Example #2: Interrupt Method. The following steps describe a typical procedure for receiving a packet with an interrupt. 1. The KTCX card sets the hardware interrupt. 2. The host removes the packet from the receive mailbox. 3. The host writes 00h to byte 0481h to clear the Receive Data Valid flag. 4. The host writes 00h to byte 0480h to clear the Receive Access Request flag. Receive Packet Example #3: Polled Method.
3-10 How Your Driver Operates the KTCX Card :0485h Link Service Access Point PKTCX 00h= on-link packet R..... ..W :0486h CMD (PCCC) PKTCX --- R........W :0487h Message Status PKTCX --- R . . . . .. . . W :0488h TNS (low byte) PKTCX --- R.... . ..W :0489h :048Ah :07EFh TNS (high byte) DATA PKTCX PKTCX ----- R.... . ..W R.... . ..W ➀ ➁ Off-link packets need 11 extra bytes which we start at byte :0468h. The remaining bytes (:0486h-:07EFh) are shifted 11 places higher.
Appendix A Example Code for Polled and Interrupt Messaging Important: Allen-Bradley assumes no liability for the use of the example code in this document. It is provided strictly as a guide for you to help you configure your 1784-KTCX card. Network Configurations for Polled and Interrupt Messaging The following network configurations are applicable for both the polled and interrupt examples.
A-2 Example Code for Polled and Interrupt Messaging Example Code for Polled Messaging /* reset the card */ outportb( H186RESET, outportb( HRESETON, The following example code shows how to setup for polled messaging over the dual-port. 0); 0); /* start the card */ outportb( HRESETOFF, 0); outportb( H186RUN, 0); /* wait a bit for the card to initialize itself */ delay(4000); /* Load initialization string into the kt dualport */ cprintf("\r\nStarting up emulation mode...wait 1/2 second\r\n"); pDP->comm.
Example Code for Polled and Interrupt Messaging A-3 /* shutdown KT emulation */ cprintf("Taking KT Emulation Mode offline (shutdown emulation)\r\n"); pDP->comm.online =0xff pDP->comm.shutdown_trig=0x01; cprintf("Waiting for KT stopped flag to go to 0xFF......\r"); while (!kbhit() && (pDP->comm.shutdown_stat != -1)) { } cprintf("KT has been shutdown \r"); *pReset = 1; pDp->comm.heartbeat = 4; PDp->comm.
A-4 Example Code for Polled and Interrupt Messaging /* Transmit 10 requests and wait for 10 responses */ for (i=0; i < 10;) { /* check if the send box is available */ if (fSendBoxAvailable == TRUE) } /* Place an id host and stat message into the dualport */ pDP->comm.send.len = 0x11; pDP->comm.send.dst = 1; pDP->comm.send.lsap = 0; memcpy(&pDP->comm.send.data[0], abIDHost, size of(abIDHost)); /* release the send box */ fSendBoxAvailable = FALSE; pDP->comm.send.shake2 = 0; pDP->comm.send.
B Appendix Defined Statements for the KTCX Card KTCX Card Definitions Important: Allen-Bradley assumes no liability for the use of the example code in this document. It is provided strictly as a guide for you to help you configure your 1784-KTCX card. This appendix describes the definitions and their corresponding values that are used to set-up and run this card: int iCard; //Global variable that is assigned prior to the macros being invoked // 0=0x200, 1=0x220,....
B-2 Defined Statements for the KTCX Card Structures that Access the KT Dual-port These structures are used to provide easier access to the KT dual-port and are referenced by the example code sections in the previous sections. Important: The following example code is written in Borland C, version 3.1. -------------------------------------------------------File Name: kt.h Application: KT Emulator for the KTCX Card.
Defined Statements for the KTCX Card typedef struct { signed char signed char signed char signed char signed char signed char signed char signed char signed char signed char signed char unsigned unsigned signed char signed char signed char signed char signed char signed char unsigned char SENDBOX RCVBOX signed char signed char signed char signed char signed char signed char signed char unused1[4]; online; // nodeaddr; // unused2[9]; reset_ctrs; // unused3[2] heartbeat; // dupnode; // shutdown_trig; // shut
B-4 Defined Statements for the KTCX Card Notes: Publication 1784-6.2.
Glossary BA— The installed Base Address of the KTCX card. DP— A mnemonic for dual-port interface. DP ADDR— The starting address of the dual-port RAM, located 03000 hex above the installed base address of the KTCX card. Connected Messaging— Messages initiated when a PLC-5C opens a connection and sends a message through it. Host— The computer running the application(s). Interrupt— Configuration where the KTCX card notifies the host of an available packet.
G-2 Node— An address on a ControlNet network. Node Table— A table of the active nodes on the network. NODEL— A mnemonic for NO DELivery. NUI (Network Update Interval)— A single occurrence of network update time (NUT). NUT (Network Update Time)— Repetitive time interval in which data can be sent on the ControlNet network. Off Line— The state where the KTCX card is not on the network and is unable to send or receive messages.
G-3 PCCC— Programmable Controller Communication Commands. These are commands for communicating with Allen-Bradley programmable logic controllers. PLCTM Controller— An Allen-Bradley programmable controller. This is a stored program device. Polled— Configuration where the host must monitor the Receive Access Request and the Receive Data Valid bytes to determine when a packet is available for processing. Receive Packet— A packet of data received from another node.
G-4 Timeout— The time allotted for a message packet response. Unconnected Messaging— Standard messages sent on the unscheduled bandwidth of a ControlNet network. Unsolicited Messaging— Non-deterministic messages transferred through ladder-initiated communication or programming devices on a ControlNet network. The KTCX card performs unsolicited messaging through connected and unconnected messaging. Publication 1784-6.2.
Index A, access request byte, receive 3-7, send 3-4, Allen-Bradley P-3, contacting for assistance P-3, C, Card Requirements, SelSegment, Offset Notation and Base Address 1-5, Cmessage timeouts 3-1, Communication, send example, of memory map of diagnostic status 3-5, communications methodology, sending data, receiving data 3-2, configuring dual-port bit values, interrupt dual-port bit values, polled dual-port bit values, initializing the KTCX card 2-3, configuring programmable controllers 1-3, contacting A
I–2 Index M, Memory Map, receive data 3-9, send data 3-6, multi-messaging queuing 3-2, multiple interrupts, interrupts, receive mailbox 3-8, N, node table, node address 1-2, O, off-line, Operating States 1-6, off-link messaging 1-3, on-line, Operating States 1-6, P, Packets, memory map, send data 3-6, send example, of diagnostic status 3-4, of memory map of diagnostic status 3-5, PCCC message packets, message packets 3-3, R, receive mailbox, memory map, receive data 3-9, Receive Examples 3-8, receive
Allen-Bradley Publication Problem Report If you find a problem with our documentation, please complete and return this form. Pub. Name 1784-KTCX Reference Manual Cat. No. 1784-KTCX Check Problem(s) Type: Pub. No. 1784-6.2.4 Pub. Date September 1997 Part No.
PLEASE FASTEN HERE (DO NOT STAPLE) PLEASE FOLD HERE NO POSTAGE NECESSARY IF MAILED IN THE UNITED STATES BUSINESS REPLY MAIL FIRST-CLASS MAIL PERMIT NO.
Allen-Bradley, a Rockwell Automation Business, has been helping its customers improve productivity and quality for more than 90 years. We design, manufacture and support a broad range of automation products worldwide. They include logic processors, power and motion control devices, operator interfaces, sensors and a variety of software. Rockwell is one of the world’s leading technology companies. Worldwide representation.