beautypg.com

Rockwell Automation 5370 CVIM Communications Manual User Manual

Page 69

background image

Chapter 4
Using the Remote I/O Link
(Node Adapter)

4–32

block_num++)

err = get_CVIM_block (CVIM_rack, 4 block_num+1,

template[block_num], &templen{block_num])

}

} break;

case 4: /* write configuration */

{

/* write all config. blocks */

for (block_num = 0; (block_num < 135) && !err; block_num++)

err = send_CVIM_block (CVIM_rack, 2, block_num+1,

config[block_num], &configlen[block_num]);

}

} break;

/*send all template blocks */

numblocks = template[0][1] >> 8;

for (block_num= 0; (block_num < numblocks) && !err

block num++)

{

err = send_CVIM_block (CVIM_rack,

4 ! (block_num == numblocks–1 ? 8: 0),block_num);

}

}

/* wait until CVIM busy bit is low */

for (t=65535; t>0 && (g_ipt[8*CVIM_rack] & 8); t––)

for (x=1; x<100; x++);

if (t==0)

{

printf (”Time–out error: CVIM busy\n”);

err = –1;

}

if (g_ipt[8*CVIM_rack] & 2)

printf (”Configuration ERROR.\n”);

else

printf (”Configuration validation OK.\n”);

} break;

} /* end switch (op_num) statement */

if (err)

printf (”Error code: %4x\n”,err);

} while (op_num >= 0);

stop_6008(); /* shut down 6008 before quitting */

}

int get_CVIM_block (CVIM_rack, block_type, block_num, data, length)

unsigned CVIM_rack, block_type, block_num, *data, *length;

/* do a BTR (read) from the CVIM */

{

static QBT block_pkt;

unsigned err, status,x;