Owner's manual

Chapter 4
Using the Remote I/O Link
(Node Adapter)
430
/* CVIM to 6008SI sample communications program */
/* Copyright AllenBradley 11290 jrm, */
/* This program was compiled using MicrosoftrC Version 5.1 */
#include <stdio.h>
#include <stdlib.h>
/* Include the 6008SI definitions */
#include <h_6008si.h>
#define TRIGGER_1_BIT 0x0400
/* define storage for configuration data */
unsigned config[135][64], configlen[135], template[256][64], templen[256];
void main()
{
QMR mr_pkt;
unsigned segment; /* segment of 6008SI card
unsigned status, err, CVIM_rack, block_num, numblocks, block1;
unsigned block2, last_blk, x, t;
int op_num, block_1;
/* Prompt enter address 6008SI card */
printf (\n\n\nCVIM to 6008SI communications sample program\n\n);
printf (Enter hex RAM address for 6008SI card (e.g. 0x000): );
scanf (%x, &segment)
/* initialize the 6008SI */
status = setup_6008(baud, 1, l, segment, &mr_pkt);
if (status != OK)
{
printf (Setup failed: command=%s, status=%s\n,
xlat_cmd(status), xlat_conf(mr_pkt.qmr_stat));
if (status != C_AUTOCONF && status != C_SETUP)
printf (Scanner fatal error %d\n, fatal_6008());
abort();
}
/* Place scanner in RUN mode */
mr_pkt.qmr_data[0] = CM_RUN;
status = mr_wait (C_SETMODE, &mr_pkt);
if (status != OK)
{
printf (Setup failed: command=%s, status=%s\n,
xlat_cmd(status), xlat_conf(mr_pkt.qmr_stat));
if (status != C_AUTOCONF && status != C_SETUP)
printf (Scanner fatal error %d\n, fatal_6008());
abort();
}
/* Disable host watchdog. For sample program ONLY ––
not recommended for any application programs. */
host_active(1);
Example 6008SI Program
(contd)