Rockwell Automation 1771-DMC_DMC1_DMC4_DXPS Control Coprocessor User Manual User Manual
Page 107

Chapter 6
Using the Ethernet Interface
6-26
unsigned char pccc_rpl[275];
void main( int argc, char** argv ){
unsigned long iostat; /* function completion value */
unsigned long rpl_siz; /* size of pccc reply */
DTSA_BKPLN addr; /* structured address */
DTL_INIT( 1 ); /* Initialize the Data Table Library */
DTL_C_CONNECT( NI_ID, HOSTNAME, 0); /* Connect */
addr.atype = DTSA_TYP_BKPLN;
addr.ni_id = NI_ID;
rpl_siz = sizeof (pccc_rpl); /* size of response buffer */
DTL_PCCC_DIRECT_W ((DTSA_TYPE *) &addr, pccc_read, sizeof (pccc_read),
pccc_rpl, &rpl_siz, 0, 0, &iostat, 60000); /* do typed read */
display_tag(); /* show the result of the read */
rpl_siz = sizeof (pccc_rpl); /* size of response buffer */
DTL_PCCC_DIRECT_W ((DTSA_TYPE *) &addr, pccc_color, sizeof (pccc_color),
pccc_rpl, &rpl_siz, 0, 0, &iostat, 60000); /* typed write to color 0x99 */
rpl_siz = sizeof (pccc_rpl); /* size of response buffer */
DTL_PCCC_DIRECT_W ((DTSA_TYPE *) &addr, pccc_read, sizeof (pccc_read),
pccc_rpl, &rpl_siz, 0, 0, &iostat, 60000); /* do typed read */
display_tag(); /* show the result of the read - note color = 0x99*/
rpl_siz = sizeof (pccc_rpl); /* size of response buffer */
DTL_PCCC_DIRECT_W ((DTSA_TYPE *) &addr, pccc_col_year, sizeof (pccc_col_year),
pccc_rpl, &rpl_siz, 0, 0, &iostat, 60000); /* write to color and year */
rpl_siz = sizeof (pccc_rpl); /* size of response buffer */
DTL_PCCC_DIRECT_W ((DTSA_TYPE *) &addr, pccc_read, sizeof (pccc_read),
pccc_rpl, &rpl_siz, 0, 0, &iostat, 60000); /* do typed read */
display_tag(); /* show the result of the read - note color = 0x99 */}
display_tag (){
/* since the pccc ”byte stream” from the coprocessor might put unsigned
variables on uneven address boundries we move them to a temporary union
variable before storing them */