A - application program examples, Sample program, Application program examples – Rockwell Automation 6001-F2E AB STANDARD DRIVER SFTW User Manual

Page 23

Advertising
background image

Appendix

A

A-1

Application Program Examples

The following program is an application that shows how to write
information to Data File 9 of an SLC-500 processor using the Application
Library and the PLC-2 (Unprotected Write) function symbol. If you are
communicating to an SLC-500 using the unprotected read or unprotected
write commands, you must first 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 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

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

/* A typical 6001-F2E Application */

/* Calling the Application Library via the APPL function dispatcher */

/* Write 2 integers to a remote SLC-500 */

/* include <stdio.h> */

/* 6001-F2E linkable driver include files: */

#include “krdefs.h”

#include “stddrv.h”

/* Define the communication device */

char device[] = “KR:0”

main()

{

#define

NORMAL 1

/* Normal F2E status */

int i

size,

/* Data qty in bytes */

d_buff[4],

/* Integer data buffer */

PLC_FCT;

char

err_msg[80];

unsigned char DST=2,

/* Byte wide destination */

unsigned int io_stat[2],

/* Status variables */

fct_stat,

/* dt_addr[2]={0,0}, */

timeout=5;

/* 5 second timeout */

Sample Program

Advertising