LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 05-09-2009, 06:31 AM   #1
payu21
LQ Newbie
 
Registered: Apr 2009
Location: australia
Posts: 12

Rep: Reputation: 0
Urgent---serial interfacing


Hi,

I am building a home light sensor system. I have measured the ambient light using LDR connected to parallel port. Now i want to turn the bulb on using Serial port and the voltage to be passed to the bulb is the from the program only.

Can anyone help me as to how to do it???

Last edited by payu21; 05-09-2009 at 07:57 AM. Reason: not correctly explained
 
Old 05-09-2009, 11:02 AM   #2
norobro
Member
 
Registered: Feb 2006
Distribution: Debian Sid
Posts: 618

Rep: Reputation: 237Reputation: 237Reputation: 237
For posterity, it would be nice if you explained how you solved your seg fault problem in this thread.

Not much to go on here. What are you trying to communicate with? The light bulb???? Got any code?

And Pixellany's quote in response to "as soon as possible" also applies to "urgent": "We have two speeds---If you don't like this one, you surely won't like the other."
 
Old 05-09-2009, 12:01 PM   #3
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738Reputation: 738
You need an adapter that connects to the serial interface and provides contact closures, or maybe relays. Google should be able to find something.

But don't use "urgent" in that Google search---there are some real horror stories where people tried that......
 
Old 05-22-2009, 01:45 AM   #4
payu21
LQ Newbie
 
Registered: Apr 2009
Location: australia
Posts: 12

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by norobro View Post
For posterity, it would be nice if you explained how you solved your seg fault problem in this thread.

Not much to go on here. What are you trying to communicate with? The light bulb???? Got any code?

And Pixellany's quote in response to "as soon as possible" also applies to "urgent": "We have two speeds---If you don't like this one, you surely won't like the other."

Hi there,

i did reply to the segmentation fault error that you mentionede before. Well, i really dnt have any idea as to how i should do this....my proff just suggested me that using the circuit attached here i can do it...

he said i should turn the DTR pin low and high with the delay i have used in parallel port code...

but m not understanding how to write the code for it ...

can u please help me???
Attached Thumbnails
Click image for larger version

Name:	esp05 May. 09.gif
Views:	7
Size:	4.9 KB
ID:	670  
 
Old 05-22-2009, 04:56 AM   #5
janhe
Member
 
Registered: Jul 2007
Location: Belgium
Distribution: slackware64 13.1, slackware 13.1
Posts: 369

Rep: Reputation: 49
So your question actually is: How do I assert/clear the DTR?
You want to do it without doing anything else to the port, and you want to do it fast (so you can control the LED brightness)

Why didn't you say so right away?

Now I've googled for serial assert DTR linux programming

and I've found this:
http://books.google.nl/books?id=75ee...um=6#PPA141,M1

page 144-147 look promising

When you're a newbie, the hardest part is asking the right question. That's ok for now, you've only just begun. But you also have to remember that in every irritated remark there's a hint to how you should ask your questions. Try not to repeat your mistakes. Holding back info and saying you're in a hurry doesn't help. Giving as much detail as you can, and being patient usually means you get an answer quicker.

Edit: Is using linux part of the assignment, or did you choose yourself to build a solution for linux?

Last edited by janhe; 05-22-2009 at 04:58 AM.
 
Old 05-24-2009, 04:32 AM   #6
payu21
LQ Newbie
 
Registered: Apr 2009
Location: australia
Posts: 12

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by janhe View Post
So your question actually is: How do I assert/clear the DTR?
You want to do it without doing anything else to the port, and you want to do it fast (so you can control the LED brightness)

Why didn't you say so right away?

Now I've googled for serial assert DTR linux programming

and I've found this:
http://books.google.nl/books?id=75ee...um=6#PPA141,M1

page 144-147 look promising

When you're a newbie, the hardest part is asking the right question. That's ok for now, you've only just begun. But you also have to remember that in every irritated remark there's a hint to how you should ask your questions. Try not to repeat your mistakes. Holding back info and saying you're in a hurry doesn't help. Giving as much detail as you can, and being patient usually means you get an answer quicker.

Edit: Is using linux part of the assignment, or did you choose yourself to build a solution for linux?

Don't you think that the bit is too complex to be used. What i think is just write a code where,
initialise the com port
set the DTR pin high by passing one to it
and then make it low???

but in all this thing i just am confused with one point...how will i send the stored voltage value to LED???
 
Old 05-24-2009, 05:08 AM   #7
payu21
LQ Newbie
 
Registered: Apr 2009
Location: australia
Posts: 12

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by payu21 View Post
Don't you think that the bit is too complex to be used. What i think is just write a code where,
initialise the com port
set the DTR pin high by passing one to it
and then make it low???

but in all this thing i just am confused with one point...how will i send the stored voltage value to LED???
Can anyone help me in writing the code??

Last edited by payu21; 05-24-2009 at 09:09 AM.
 
Old 05-24-2009, 02:13 PM   #8
janhe
Member
 
Registered: Jul 2007
Location: Belgium
Distribution: slackware64 13.1, slackware 13.1
Posts: 369

Rep: Reputation: 49
In what I linked, there is a piece of code that, I think, sets DTR high, and one to set it low.

To control the brightness of your LED, just change the time how long DTR is high or low. (If I am right, which I hardly ever am, the longer DTR is zero, the brighter the LED.

Think of it like this: when the LED is continuously fed with 3.3V, then is emits light at maximum brightness.
When it is fed 3.3V for half a second, and 0V for half a second, it has emitted only half the amount of light during that second.

If you change the voltage very rapid, but at a rate that ensures the LED get 0V half of the time and 3.3V the other half of the time, the LED appears to give light at half brightness.

If you change the time the LED gets 0V to be longer, the LED will appear dimmer, if you change the time the LED get 3.3V to be longer, the LED will appear brighter.

Nobody will write the code for you. You will have to do that yourself. No matter in what forum you post (general, newbie, ...) That is the only way you will learn how to do it. And the only way we can be sure you won't stay a newbie forever.

EDIT: please choose one tread in which you ask us to help solve your problems. Please stop opening new treads about this issue. Please post back when you make progress, any kind of progress.

We want to help you, but you have to make an effort yourself. If you don't understand, ask more questions, with more detail about what you don't understand.

Perhaps you should post some more details and extra questions in this tread, and use that tread from now on: http://www.linuxquestions.org:80/que...l-port-728161/

Last edited by janhe; 05-24-2009 at 02:46 PM.
 
  


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
usb to serial converter - Configuration in RHEL 5 - Urgent lakshmidevip@hcl.in Linux - Newbie 3 06-22-2008 12:21 PM
AX.25 interfacing alek66 Linux - Hardware 0 12-01-2006 09:19 AM
Serial/Parallel/Game Port Interfacing sparkyssb Programming 8 06-29-2006 01:41 PM
interfacing TI-83 1337 Twinkie Programming 2 10-15-2004 07:09 PM
Interfacing with websites in C smackboy Programming 2 01-29-2004 03:38 AM


All times are GMT -5. The time now is 04:01 AM.

Main Menu
Advertisement
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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration