Plc-2 unprotected read – Rockwell Automation 6001-F2E AB STANDARD DRIVER SFTW User Manual

Page 26

Advertising
background image

Application Program Examples

Appendix A

A-4

/* ––––––––––––––––––––––––––––––––––––––––––––––––––– */

/*

DH/DH+ Application Library (c) 1989 Allen–Bradley

APPLICATION: PLC–2 Unprotected Read

SYMBOL: PLC2_URD

Include files:

Linkable Driver:

#include “krdefs.h”

#include “stddrv.h”

Application Variables:

int

size,

PLC_FCT;

d_buff[...]

unsigned int status,

io_stat[2],

dt_addr = 0110,

timeout;

char

device[]= “KR:0”;

unsigned char destination;

struct SD_FB DHP_MSG;

*/

/* Initialize the DH-485 function block */

DHP_MSG.dev = device; /* Communication device */

DHP_MSG.stat = &io_stat[0]; /* I/O status */

DHP_MSG.L_R = 0;

DHP_MSG.dst = &destination; /* DH-485 address */

DHP_MSG.dta = &dt_addr; /* DT address(byte location) */

DHP_MSG.len = size; /* Size in bytes (max 244) */

DHP_MSG.buf = &d_buff[0]; /* Read buffer */

DHP_MSG.TO = timeout; /* Reply timeout in sec */

PLC_FCT = PLC2_URD; /* Initialize a PLC function */

PLC-2 Unprotected Read

Advertising