Rockwell Automation 6001-F2E AB STANDARD DRIVER SFTW User Manual
Page 24

Application Program Examples
Appendix A
A-2
/* DH-485 function block description found in STDDRV.H */
struct SD_FB DHP_MSG;
/* DH-485 function block */
/* Start the 6001-F2E software */
fct_stat = Open_StdDrv(device,0,0,0,
(struct unsol_msg *)NULL,0,0,0);
/* If the open was unsuccessful display the error and exit */
if (fct_stat != NORMAL){
Get_ErrMsg(fct_stat, err_msg);
printf(”n%s\n”,err_msg);
exit(1);
}
/* Initialize the data to be sent to the SLC-500 */
d_buff[0] = 1;
/* Integer value 1 */
d_buff[1] = 2;
/* Integer value 2 */
size = 4;
/* This example uses 2-byte integers so size is.. */
/* .... 2 times the number of integers sent */
/* 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 = &DST; /* DH-485 address */
DHP_MSG.dta = &dt_addr; /* DT address */
DHP_MSG.len = size; /* Size in bytes */
DHP_MSG.buf = &d_buff[0]; /* Write buffer */
DHP_MSG.TO = timeout; /* Reply timeout in sec */
PLC_FCT = PLC2_UWR;
/* Initialize a PLC function */
/* Write 2 integer values to a SLC-500 file at remote station DST */
fct_stat = Appl_StdDrv( PLC_FCT,&DHP_MSG); */