beautypg.com

ProSoft Technology MVI56E-LDM User Manual

Page 152

background image

CIP API Functions

ControlLogix Platform ♦ "C" Programmable

Developer's Manual

Linux Application Development Module

Page 146 of 264

ProSoft Technology, Inc.

March 12, 2014

OCX_ID_STATUS_DEBUG_MODE

: Debug mode if controller is in Run Mode

timeout

is used to specify the amount of time in milliseconds the application

should wait for a response from the device.

Return Value

OCX_SUCCESS

ID object was retrieved successfully

OCX_ERR_NOACCESS

apihandle

does not have access

OCX_ERR_MEMALLOC

returned if not enough memory is available

OCX_ERR_BADPARAM

returned if path was incorrect

Example

OCXCIPHANDLE apihandle;
WORD status;
BYTE Path[]="p:1,s:0";

// Read ID status from ControlLogix in slot 0

OCXcip_GetDeviceIdStatus(apihandle, &Path, &status, 5000);

printf("\n\r");
switch (Status & OCX_ID_STATUS_DEVICE_STATUS_MASK)
{
case OCX_ID_STATUS_FLASHUPDATE: // Flash update in progress
printf("Status: Flash Update in Progress");
break;
case OCX_ID_STATUS_FLASHBAD: //Flash is bad
printf("Status: Flash is bad");
break;
case OCX_ID_STATUS_FAULTED: //Faulted
printf("Status: Faulted");
break;
case OCX_ID_STATUS_RUN: //Run mode
printf ("Status: Run mode");
break;
case OCX_ID_STATUS: //Program mode
printf ("Status: Program mode");
break;
default:
printf ("ERROR: Bad Status Mode");
break;
}

printf ("\n\r");
switch (Status & OCX_ID_STATUS_KEY_SWITCH_MASK)
{
case OCX_ID_STATUS_KEY_RUN: //Key switch in run
printf ("Key switch position: Run");
break;
case OCX_ID_STATUS_KEY_PROGRAM: //Key switch in program
printf ("Key switch position: Program");
break;
case OCX_ID_STATUS_KEY_REMOTE: //Key switch in remote
printf ("Key switch position: Remote");