Df1 programming example (cont’d) – Rockwell Automation 5370 CVIM Communications Manual User Manual
Page 128

Chapter 5
Using the RS–232 Ports
5–58
if (err)
{
/* read first template block */
err = get_message(portnum, template [0] & templen [0]);
/* Determine how many template blocks follow */
numblocks = template [0] [2];
for (x=1 (X<numblocks) && !err; x++)
{
err = get_message(portnum, template [x] & templen [x]);
}
}
}
break;
case 10:
/* 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”,19);
for (x=0; x<5000 x++); /* give CVIM time to prepare */
if (err)
{
/* write config blocks 1-135 */
for (x—0 (x<135) && !err; x++)
err = send_message(portnum, config [x] & config [x]);
if (err)
{
/* write all template blocks */
numblocks = template [0] [2];
for (x=0 (X<numblocks) && !err; x++)
err = send_message(portnum, template [x] & templen [x]);
err = get_message(portnum, template [0] & templen [0]);
}
}
break;
case 11:
err =send_message(portnum,”\013\002\017”, 3);
break;
case 12:
err =send_message(portnum,”\013\002\022”, 3);
break;
case 13:
err =send_message(portnum,”\013\002\023”, 3);
break;
DF1 Programming
Example (cont’d)