beautypg.com

Rockwell Automation 5370 CVIM Communications Manual User Manual

Page 127

background image

Chapter 5

Using the RS-232 Ports

5–57

err = get_message(portnum,reply, & replen);

break;

case 7: /* read results block 1 tool set 2 */

err =send_message(portnum,”\007\000\001\025\001”,5);

if (!err)

{

err = get_message(portnum,results, & reslen);

if (!err)

printf (”Results block #1:\n”);

/* Display the results block */

for (x=0; x

printf (”%04x”, results [x] *256 + results [x+1]);

printf (”\n”);

}

}

break;

case 8:

err =send_message(portnum,”\026\000\062\004\000\000\000\000”

”\001\000\000\000\000\000\000\000\000\000\000\000”,20);

for (x=0; x<5000 x++); /* give CVIM time to prepare */

if (err)

{

err = send_message(portnum, ”\27\0\1”, 3);

if (err)

{

err = get_message(portnum,results, & reslen);

for (x=0; x<5000 x++); /* give CVIM time to prepare */

if (err)

{

printf (”Gage #1 Stats \n”);

for (x=0; x

printf (”%04x”, results [x] *256 + results [x+1]);

printf (”\n”);

}

}

}

break;

case 9:

/* read configuration */

/* read all config. blocks */

err =send_message(portnum,”\6\7\377\377\377\377\377\377\377”

”\377\377\377\377\377\377\377\377\377\377”,19);

if (err)

{

/* read config blocks 1-135 */

for (x—0 (x<135) && !err; x++)

err = get_message(portnum, config [x] & config [x]);