beautypg.com

ProSoft Technology MVI69E-LDM User Manual

Page 50

background image

Contents

MVI69E-LDM ♦ "C" Programmable

Developer's Manual

Linux Application Development Module

Page 50 of 130

ProSoft Technology, Inc.

August 21, 2014

4.2.3 LED Sample

This program shows how to interact with the MVI69E-LDM hardware at the most basic level.

To run the LED sample:

1 Establish a command window using Telnet or similar terminal software program on the

PC, through either the Ethernet or Serial P1 port.

2 Login as user: root, using password: password.

To execute the sample:

1 Navigate to the default home directory

/psft/sample

and type the command

./Led_Sample&

. This will run the Led_Sample program in the background.

2 Looking at the sample source, you'll see that the program:

o

registers Linux event handlers using the

signal

function.

o

opens a connection to the hardware via the MVI69 library API

MVI69_Open

. Although

the

MVI69_OpenNB

routine could be used (since this sample does not communicate

across the backplane).

o

reads the module information using

MVI69_GetModuleInfo

an displays this information

to the terminal.

o

reads the version information of the MVI69 driver using

MVI69_GetVersionInfo

and

displays this information to the terminal.

o

reads the state of the serial configuration jumpers using

ShowSerialJumpers

and

prints this information to the terminal.

o

reads the state of the Setup Jumper using the function

MVI69_GetSetupJumper

and

prints this information to the console.

o

initializes all LEDs to OFF.

3 The program then uses two nested loops to cycle through the LEDs and changes the

state of the LED to every possible display state. This uses the

MVI69_SetLED

function.

4 Exit the program by killing it (CTRL-C or kill -9).