Rockwell Automation 1747-PCINT API Software for 1746 I/O User Manual

Page 36

Advertising
background image

3–10

Developing Applications

Publication 1747-6.5.3 June 1998

/*
** Read first Input word
*/
retcode = OC_ReadInputImage( Handle, NULL, input_slot, 0, 1, &wData );
if ( retcode != SUCCESS )
{

printf( ”\nERROR: OC_ReadInputImage failed: %d\n”, retcode );
Ioexit( 1 );

}
printf( ”\n\n First input image data word --> 0x%04x \n”, wData );
delay( 3000 );

/*
** Write to the first Output word
*/

printf( ”\n\n Incrementing first discrete output word. \n” );
for ( wData=0; wData < 256; wData++)
{

retcode = OC_WriteOutputImage( Handle, NULL, output_slot, 0, 1, &wData );
if ( retcode != SUCCESS )
{

printf(”\nERROR: OC_WriteOutputImage failed: %d\n”, retcode);
Ioexit(1);

}
delay ( 10 );

}

/*
** Must always close the scanner before exiting
*/
OC_CloseScanner( Handle );

printf( ”\n\n Program is done! \n\n” );

}

/* end main() */

Scan I/O
See page
6-54 and
6-90.

Advertising
This manual is related to the following products: