ProSoft Technology MVI56E-LDM User Manual
Page 56

Understanding the MVI56-LDM API
ControlLogix Platform ♦ "C" Programmable
Developer's Manual
Linux Application Development Module
Page 50 of 264
ProSoft Technology, Inc.
March 12, 2014
4.13 Led_Sample
The LED Sample program is designed to show one or more groups of
functionality provided in the module. This sample covers the following functions:
Open backplane driver
Interpreting errors returned by the backplane driver
Reading module configuration jumpers
Display message on the 4-character front panel
Changing the state of the front panel LEDs
This sample program illustrates how to interact with the MVI56E-LDM hardware
at the most basic level.
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
./Led_Sample&
. This
will run the LED 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
OCXcip_Open
.
Although the
OCXcip_OpenNB
routine could be used, (since this sample does
not communicate across the backplane), the module status will not flash
red/green if opened with the NB variant.
display "
open success
" on the 4-character display using the function Display.
read the state of the Setup Jumper using the function
ReadSwitches
and prints
this information to the console.
read the state of the serial configuration jumpers using
Get_Serial_Config
and prints this information to the console.
initialize timer functionality
Change LEDs on the front panel to a default state using the
SetLed
function:
o
Module status if the OK LED.
o
User LED is the APP LED.
o
LED3 is the ERR LED.
The program then goes into an infinite loop, looking for the expiration of two
timers:
a fast timer which cycles the LEDs through their states and scrolls the last
string across the 4-character front panel display.
a slow timer which updates the string for the front panel display.