ProSoft Technology MVI56E-LDM User Manual
Page 57

ControlLogix Platform ♦ "C" Programmable
Understanding the MVI56-LDM API
Linux Application Development Module
Developer's Manual
ProSoft Technology, Inc.
Page 51 of 264
March 12, 2014
4.14 Backplane_Sample
The Backplane Sample program is designed to show block transfer
communication with the ControlLogix controller in slot 0 of the ControlLogix rack.
The ControlLogix controller must be loaded with the sample ladder logic and be
configured to communicate with the MVI56E-LDM module. The ladder is
LDM.ACD
.
To use this program, establish a command window using telnet or similar
terminal software on the PC using either the Ethernet or Serial P1 port.
Login as user: root, using password password.
To execute the sample...
From the default home directory (
/psft
), type the command
./Backplane_Sample&
. This will run the Sample program in the background.
While looking at the sample source, you'll see that the main program will....
open a connection to the hardware via the OCX library API using the
open_backplane
routine. The open_backplane function will:
o
call
OCXcip_Open
to get access to the LDM hardware and backplane
o
change the module identity by reading the identity using
OCXcip_GetIdObject
, changing the values of the object Id structure, and
then setting the identity with the
OCXcip_SetIdObject
routine.
The backplane connection service and service callback routines are then
registered with the backplane driver using the
OCXcip_RegisterAssemblyObj
routine.
set each of the front panel LEDs, reads back the state of the LED, and prints
the result to the console:
o
OK LED - Module status is set to Solid Green using
OCXcip_SetModuleStatus
routine and read back using the
OCXcip_GetModuleStatus
routine
o
APP LED - the User LED is turned off using the
OCXcip_SetUserLED
routine and read back using the
OCXcip_GetUserLED
routine.
o
ERR LED - LED3 is set to off using the
OCXcip_SetLED3
routine and read
back using the
OCXcip_GetLED3
routine.
read the real-time clock of the ControlLogix process using
OCXcip_GetWCTime
and the time is printed to the console
enter a main (infinite loop) and within this loop, the program will:
o
wait for a connection to be established by the ControlLogix processor.
The routine
Backplane_ConnectProc
is started when this occurs. The
routine sets the global variable
Backplane_Connected
which the main
program loop monitors.
read a block of data (one the connection is established) from the controller
using the
OCXcip_ReadConnected
API call.