Appendix b: programming the status led, Appendix b, Programming the status led – Lanner LEC-3012 User Manual
Page 29

29
Programming the Status LED
Appendix B
Embedded and Industrial Computing
Appendix B:
Programming the Status
LED
The Status LED (RUN LED) is designed to provide the status
indicator for certain function of system. You can program
it to indicate the status of designated functionality. For
sample Status LED code, see sled folder under Driver and
Utility on the Driver and Manual CD.
Note:
For DOS environment, use DJGPP as compiler
1.
and the makefile: Makefile.dos.
For Linux, support kernel versions are 2.4.x and
2.
2.6.x. Use the makefile:Makefile.linux.
For FreeBSD, support version is FreeBSD 8.0.
3.
use the makefile: Makefile.
Build
To build program source code on Linux platform, use the
following steps as a guideline:
Copy the proper makefile from the Driver and Manual
1.
CD to your system
Set the access mode with these two parameters
2.
by editing the Makefile.linux directly: DIRECT_IO_
ACCESS= [0|1] (enter either 1 or 0) and LANNER_
DRIVER= [0|1] (enter either 1 or 0). 1 is for direct access
and no driver is needed. You will only need to execute
the program directly. However, when it equaled to 0,
driver installation is needed. Refer to the following
Install section for more details.
Type make to build source code:
3.
make Makefile (Note: omit the file extensions)
After compilation, the executable program (sled_tst) and
the driver (sled_drv.[k]o) will be in the bin subdirecto
Install
The installation procedures depend on the access mode
that you have set by using the above mentioned method.
If you have set DIRECT_IO_ACCESS=1, driver installation is
not necessary. Proceed to the next section on executing
If you have set DIRECT_IO_ACCESS=0, Lanner driver needs
to be installed. Install the driver and create a node in the /
dev directory as shown in the following example:
For Linux:
Insert module and create node in /dev as below
example:
#insmod sled_drv.[k]o
#mknod /dev/sled_drv c 240 0
For FreeBSD:
Insert module as below example:
#kldload -v ./sled_drv.ko
Execute
Once build completed, application (and driver) is available
in bin sub-directory.
Just run “sled_tst” for testing the statue LED. The RUN
LED can be programmed to show the status of the user-
defined program. This sample program demonstrates
lighting the LED for 4 seconds.
screen capture of the execution result:
Note: For more details, refer to the README file
contained within the program