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

Page 43

Advertising
background image

Developing Applications

3–17

Publication 1747-6.5.3 Junel 1998

/* Set output update mode to always */
if (SUCCESS != (rc = OC_SetOutputUpdateMode(OChandle, OUTUPD_ALWAYS)))
{
printf("\nERROR: OC_SetOutputUpdateMode failed: %d\n", rc);
Ioexit(1);
}

/* Set scan time to 5ms, periodic scan mode */
if (SUCCESS != (rc = OC_SetScanTime(OChandle, SCAN_PERIODIC, 20)))
{
printf("\nERROR: OC_SetScanTime failed: %d\n", rc);
Ioexit(1);
}

/* Goto Scan Mode */
if (SUCCESS != (rc = OC_SetScanMode(OChandle, SCAN_RUN)))
{
printf("\nERROR: OC_SetScanMode failed: %d\n", rc);
Ioexit(1);
}

/* Turn on User LED 1 */
if (SUCCESS != (rc = OC_SetUserLEDState(OChandle, 1, LED_GREEN_SOLID)))
{
printf("\nERROR: OC_SetUserLEDState failed: %d\n", rc);
Ioexit(1);
}

/* Read word 0 of IB32 module */
if ( IB32slot != 0 )
{ if (SUCCESS != (rc = OC_ReadInputImage(OChandle, NULL, IB32slot, 0, 1, &wData)))
{
printf("\nERROR: OC_ReadInputImage failed: %d\n", rc);
Ioexit(1);
} }

/* Write the data read to word 2 of BAS module M0 file */
wLen = 1; if ( BASslot != 0 )
{
if (SUCCESS != (rc = OC_WriteModuleFile(OChandle, FILTYP_M0, &wData, BASslot,
2, wLen)))
{
printf("\nERROR: OC_WriteModuleFile failed: %d\n", rc);
Ioexit(1);
}
}

/* Close the scanner before exiting */
OC_CloseScanner(OChandle);

return(0);

} /* end main()*/

Control scanner
operation
See pages 6-70
and 6-73.

Scan I/O
See pages
6-54 and
6-88.

Advertising
This manual is related to the following products: