ProSoft Technology MVI56E-LDM User Manual
Page 59

ControlLogix Platform ♦ "C" Programmable
Understanding the MVI56-LDM API
Linux Application Development Module
Developer's Manual
ProSoft Technology, Inc.
Page 53 of 264
March 12, 2014
4.15 Tag_Sample
The Tag sample program shows block transfer communication with the
ControlLogix controller in Slot 0 of the ControlLogix rack. The Controller must be
loaded with the sample ladder logic and configured to communicate with the
MVI56E-LDM module. The ladder is
LDM.ACD
.
To run the Tag sample:
1 Open a command window using telnet or a similar terminal software on the
PC through a serial (P1) or Ethernet port.
2 Login as user: root, password: password.
To execute the sample:
1 From the default home directory
/psft
, type the command
./Tag_Sample&
.
The program runs as a background task.
While looking at the 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:
o
OK LED - Module status is set to Solid Green
o
APP LED - the User LED is turned off
o
ERR LED - LED3 is set to off
read the series and revision of the API, backplane engine, and device driver
using
OCXcip_GetVersionInfo
and prints it to the console.
call
print_rack_information
to read the size and modules in the current rack
using
OCXcip_GetActiveNodeTable
and prints to the console. Additionally, this
routine reads detailed information about the controller in Slot 0 using the
OCXcip_GetExDevObject
routine and prints the information to the console.
display "Run" on the LDM front panel using a call to
Display
.
The program enters a main infinite loop and waits for the ControlLogix controller
to open a connection to the MVI56E-LDM. Once the connection is established:
the LDM module's status is changed to connected and owned using two calls
to
OCXcip_SetModuleStatusWord
.
the rack information is printed to the console again
the entire tag database is read and printed to the console using
open_tag_dbase
.
This routine does the following: