Appendix a, Example code for polled and interrupt messaging, Network configurations for polled and interrupt me – Rockwell Automation D17846.2.4 CONTROLNET KT EMULA User Manual
Page 31: Int icard=1; char stack[1024]; //temporary stack f, The following variables are used as part of emu, Pointer to the kt dualport */ dp *pdp=mk_fp(0xd, Pointer to location 0x802 (assert card)*/ char, Pointer to location 0x803 (deassert card) */ ch, Pointer to kt interrupt enable flag. */ char *p, Send flag polled by main code and set by interru

1784-6.2.4 - September 1997
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.
Assume the following:
•
PLC5 programmable controller is at node 1
•
KTC dual-port address is at 0xD000
•
KTC I/O address is 0x220
•
IRQ 5
Important: The following example code is written in Borland C,
version 3.1.
Global variables:
int iCard=1;
char stack[1024];
//temporary stack for interrupt
int __SS, __SP;
//temporary stack switch
volitale int iNumInts;//general counter
/* The following variables are used as part of emulation mode processing */
/* Pointer to the KT dualport */
DP
*pDP=MK_FP(0xD300, 0);
/* Pointer to location 0x802 (assert card)*/
char
*pRun=MK_FP(0xD300, 0x803);
/* Pointer to location 0x803 (deassert card) */
char
*pReset=MK_FP(0xD300, 0x803);
/* Pointer to KT interrupt enable flag. */
char
*pIntMode=MK_FP(0xD300, 0x801);
/*Send flag polled by main code and set by interrupt handler. When true,the send box is available.*/
volatile int fSend Box Available;
/* Same as send but for receive box.*/
volatile int fRecvBox Available;
/* Holds the address of the previous interrupt handler (if any) */
void interrupt (*oldhandler)(void);
/* ID host and status transmission string */
char abIDHost[]={6,0,0,1,3,0};