Rockwell Automation 1771-DMC_DMC1_DMC4_DXPS Control Coprocessor User Manual User Manual

Page 135

Advertising
background image

API Library of Routines

Appendix B

BPI_DISCRETE

B-4

The only bits available for use by the application program are the upper 8
bits (10-17). The lower 8 bits (0-7) are reserved for block transfer, even if
there are no block transfers programmed to the control coprocessor.

C Example

unsigned short output_img;

unsigned short input_img;

int mode = MODIFY

.

.

.

input_img = 0xF800;

/* bit pattern to PLC-5

controller input word */

output_img = BPI_DISCRETE (MODE, input_img); /* send to inpt image,

get from output image*/

if (output_img & 0x0100)

do_bit_0_true_function ( );.

.

.

.

BASIC Example

The BASIC function code is 32.

Important: For BASIC, the data type for the

input_img

and

output_img

parameters is INTEGER.

DIM inputimg,outputimg : INTEGER

.

.

.

inputimg=256

.

.

RUN AB_BAS(32,outputimg,1,inputimg)

.

.

.

References

BPI_READ(); BPI_WRITE();

Advertising