ProSoft Technology MVI69E-LDM User Manual
Page 51

MVI69E-LDM ♦ "C" Programmable
Contents
Linux Application Development Module
Developer's Manual
ProSoft Technology, Inc.
Page 51 of 130
August 21, 2014
4.2.4 Backplane Sample
The Backplane Sample program shows block transfer communication with the
CompactLogix controller in slot 0 of the CompactLogix rack. The CompactLogix controller
must be loaded with the sample ladder logic and be configured to communicate with the
MVI69E-LDM module. The ladder is
MVI69_LDMACD
.
To run the Backplane sample:
1 Establish a command window using Telnet or similar terminal software on the PC
through either the Ethernet or Serial P1 port.
2 Login
user:
root
password:
password
To execute the sample:
1 Navigate to the default home directory
/psft/sample
and type the command
./Backplane_Sample&
to run this program as a background task.
2 Reviewing the source code for the Backplane Sample, the program:
registers Linux event handlers using the
signal
function.
opens a connection to the hardware via the backplane library API using the
open_backplane
routine. The
open_backplane
will:
o
change the module information with the
MVI69_SetModuleInfo
routine.
o
call
MVI69_Open
to get access to the LDM hardware and backplane.
o
read the size of the configured IO using
MVI69_GetIOConfig
.
o
read and display the module identity using
MVI69_GetModuleInfo
.
sets each of the front panel LEDs to a default using the
MVI69_SetLED
function.
enters a main (infinite loop) within this loop. The program will:
o
first read the current run/program mode of the processor using
MVI69_GetScanMode
,
and prints the state if it has changed since the last time it was read.
o
wait for an Input Scan from the CompactLogix processor using the
MVI69_WaitForInputScan
function.
Note:
MVI69_WaitForOutputScan
could also be used.
o
MVI69_GetScanCounter
function is used to read the number of the scan. The scan
count modulo 5000 is used in data write (i.e., controller input data) a few lines below.
o
read output data (read data for the module) from the controller using the function
MVI69_ReadOutputImage
.
o
If the second element has changed since the last read, the new data is copied from
the read (controller output) data to the write (controller input) data. If the data has not
changed, the data in the writer buffer is decremented. The scan count (read above)
is written to the 0th element.
o
write the data back for the controller to read using the
MVI69_WriteInputImage
function.