LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 03-19-2004, 05:40 AM   #1
mcp_achindra
LQ Newbie
 
Registered: Mar 2004
Location: Makhanlal Chaturvedi University, Bhopal, INDIA
Posts: 11

Rep: Reputation: 0
Unhappy How to write Device Driver to control LED?


If any one can help me in writing device driver, to handle simple works like controlling a seven segment LCD Display or controlling a Stepper motor or controlling an LED from serial port on Linux System.

I have the option to write a device driver to control the switching of an LED through a serial port on Linux system. I would then extend it to support more complex functioning.

The first stage is to design a device driver to send +ve voltage on Serial Port to which an LED is attached.

Then to design an interface over that.

Then to extend the driver to support complex functions.

But all that on Linux.

I can write code in C to send +ve voltage to serial ports, but am not able to convert that to device driver.

Looking for help and generous support.
 
Old 04-01-2004, 06:33 AM   #2
nhs
Member
 
Registered: Aug 2003
Location: Edinburgh, Scotland
Distribution: Gentoo
Posts: 246

Rep: Reputation: 30
Driver writing is a complex task but the O'Reilly book "Linux Device Drivers" is brilliant. In short a module is normally written in C. You define the functions int init_module(void) and void cleanup_module(void) to handle loading and unloading the module. Other functions can be used to create entries into /dev or /proc, write to I/O ports / memory, etc. Note that debugging kernel code is a fair bit harder than debugging a normal program as incorrect code can potentially hang the kernel and you have no access to the standard C libraries (i.e. many useful functions disappear). The O'Reilly book I mentioned is available to read on the web at http://www.xml.com/ldd/chapter/book/index.html and contains a lot more information than I can post.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
write control character q on linux 7.2 suchi_s Linux - Software 1 03-21-2005 03:03 AM
how to write device driver for Irda santu432 Programming 1 07-23-2004 12:29 PM
how to write a device driver raghu mitra Linux - Software 1 07-22-2004 02:26 PM
remote control device driver infamous41md Programming 5 03-09-2004 11:47 AM
how to write a device driver dummyagain Programming 3 10-20-2003 08:36 AM


All times are GMT -5. The time now is 03:38 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration