Rockwell Automation 5370 Color CVIM Communications Manual User Manual
Page 133

Chapter 5
Using the RS–232 Ports
5–65
case 3: /* read results block 1 */
{
err = send_message (portnum, ”\007\000\001\020\001”,5);
if (!err)
err = get_message(portnum, results, &reslen);
/* Display the results block */
if (reslen && !err)
{
printf (”Results block #1:\n”);
for (x=0; x
printf (”%04X ”,results[x]*256 + results[x+1]);
printf (”\n”);
}
} break;
case 4: /* read configuration */
{
/* send the read all config. blocks command*/
err = send_message (portnum,”\6\7\377\377\377\377\377”
”\377\377\377\377\377\377\377\377\377\377\377”
”\377\377\377\377\377\377\377\377\377\377\037”,29);
/* read config blocks 1–213 */
printf (”Reading Configuration Blocks 1–213. Please
Wait.\n”);
for (x=0; (x<213) && !err; x++)
err = get_message(portnum,config[x],&configlen[x]);
} break;
case 5: /* write configuration */
{
/* write entire config. */
err = send_message (portnum,”\13\7\377\377\377\377\377”
”\377\377\377\377\377\377\377\377\377\377\377”
”\377\377\377\377\377\377\377\377\377\377\037”,29);
/* give Color CVIM time to prepare */
for (x=0; x<25000; x++);
if (!err)
/* write config blocks 1–213 */
printf (”Writing Configuration Blocks 1–213. Please
Wait.\n”);
for (x=0; (x<213) && !err; x++)
err = send_message(portnum,config[x],configlen[x]);
} break;
} /* End switch (op_num) statement */
if (err)
printf (”Error code: %4x\n”,err);