Example 6008–si program (cont’d) – Rockwell Automation 5370 Color CVIM Communications Manual User Manual
Page 65

Chapter 4
Using the Remote I/O Link
4–28
/* This program was compiled using Microsoft C Version 6.0 */
/* Color CVIM to 6008–SI sample communications program */
/* Copyright Allen–Bradley 1–12–92 jrm, dms */
#include
#include
/* Include the 6008–SI definitions */
#include
#define TRIGGER_1_BIT 0x0400
/* define storage for configuration data */
unsigned config[213][64], configlen[213];
void main()
{
QMR mr_pkt;
unsigned segment; /* segment of 6008–SI card */
int baud, irq_l; /* 6008–SI card baud rate and interrupt line */
unsigned status, err, CVIM_rack, block_num, numblocks, block1;
unsigned block2, last_blk, x, t;
int op_num, block_1;
/* Display Program Execution and Description. */
printf (”\nColor CVIM to 6008–SI sample communication program.\n”);
printf (”Copyright Allen–Bradley 01–12–90 jrm, dms.\n”);
printf (”This program was used and tested on a 33 MHz 386 Computer.\n”);
printf (”The Color CVIM Communication Parameters for this program are:\n”);
printf (” CFG Host: Remote I/O\n”);
printf (” SYS Host: Remote I/O\n”);
printf (” Trigger Source = (Hosted)\n”);
printf (” Remote I/O Enabled\n”);
printf (” Remote I/O Rack Address 2\n”);
printf (” Remote I/O Data Rate 57.6\n”);
printf (” Color CVIM must be in RUNMODE\n”);
/* Prompt – enter address, baud rate, and interrupt line of 6008 card */
printf (”\nColor CVIM to 6008–SI communications sample program\n\n”);
printf (”Enter hex RAM address for 6008–SI card (e.g. D000): ”);
scanf (”%x”, &segment);
printf (”Enter baud rate multiplier for 6008–SI card (e.g. 1=57.6 2=115.2): ”);
scanf (”%d”, &baud);
printf (”Enter interrupt control line for 6008–SI card (e.g. 3 5 10 or 12): ”);
scanf (”%d”, &irq_l);
/* initialize the 6008–SI */
status = setup_6008(baud, 1, irq_l, segment, &mr_pkt);
if (status != OK)
{
printf (”Setup failed: command=%s, status=%s\n”,
xlat_cmd(status), xlat_conf(mr_pkt.qmr_stat));
Example 6008–SI Program
(cont’d)