Welcome
Username or Email:

Password:


Missing Code




[ ]
[ ]
Online
  • Guests: 23
  • Members: 0
  • Newest Member: omjtest
  • Most ever online: 396
    Guests: 396, Members: 0 on 12 Jan : 12:51
Members Birthdays:
All today's birthdays', congrats!
Mathias (41)
slash128v6 (52)


Next birthdays
01/31 Mathias (41)
01/31 slash128v6 (52)
02/01 Barry (70)
Contact
If you need assistance, please send an email to forum at 4hv dot org. To ensure your email is not marked as spam, please include the phrase "4hv help" in the subject line. You can also find assistance via IRC, at irc.shadowworld.net, room #hvcomm.
Support 4hv.org!
Donate:
4hv.org is hosted on a dedicated server. Unfortunately, this server costs and we rely on the help of site members to keep 4hv.org running. Please consider donating. We will place your name on the thanks list and you'll be helping to keep 4hv.org alive and free for everyone. Members whose names appear in red bold have donated recently. Green bold denotes those who have recently donated to keep the server carbon neutral.


Special Thanks To:
  • Aaron Holmes
  • Aaron Wheeler
  • Adam Horden
  • Alan Scrimgeour
  • Andre
  • Andrew Haynes
  • Anonymous000
  • asabase
  • Austin Weil
  • barney
  • Barry
  • Bert Hickman
  • Bill Kukowski
  • Blitzorn
  • Brandon Paradelas
  • Bruce Bowling
  • BubeeMike
  • Byong Park
  • Cesiumsponge
  • Chris F.
  • Chris Hooper
  • Corey Worthington
  • Derek Woodroffe
  • Dalus
  • Dan Strother
  • Daniel Davis
  • Daniel Uhrenholt
  • datasheetarchive
  • Dave Billington
  • Dave Marshall
  • David F.
  • Dennis Rogers
  • drelectrix
  • Dr. John Gudenas
  • Dr. Spark
  • E.TexasTesla
  • eastvoltresearch
  • Eirik Taylor
  • Erik Dyakov
  • Erlend^SE
  • Finn Hammer
  • Firebug24k
  • GalliumMan
  • Gary Peterson
  • George Slade
  • GhostNull
  • Gordon Mcknight
  • Graham Armitage
  • Grant
  • GreySoul
  • Henry H
  • IamSmooth
  • In memory of Leo Powning
  • Jacob Cash
  • James Howells
  • James Pawson
  • Jeff Greenfield
  • Jeff Thomas
  • Jesse Frost
  • Jim Mitchell
  • jlr134
  • Joe Mastroianni
  • John Forcina
  • John Oberg
  • John Willcutt
  • Jon Newcomb
  • klugesmith
  • Leslie Wright
  • Lutz Hoffman
  • Mads Barnkob
  • Martin King
  • Mats Karlsson
  • Matt Gibson
  • Matthew Guidry
  • mbd
  • Michael D'Angelo
  • Mikkel
  • mileswaldron
  • mister_rf
  • Neil Foster
  • Nick de Smith
  • Nick Soroka
  • nicklenorp
  • Nik
  • Norman Stanley
  • Patrick Coleman
  • Paul Brodie
  • Paul Jordan
  • Paul Montgomery
  • Ped
  • Peter Krogen
  • Peter Terren
  • PhilGood
  • Richard Feldman
  • Robert Bush
  • Royce Bailey
  • Scott Fusare
  • Scott Newman
  • smiffy
  • Stella
  • Steven Busic
  • Steve Conner
  • Steve Jones
  • Steve Ward
  • Sulaiman
  • Thomas Coyle
  • Thomas A. Wallace
  • Thomas W
  • Timo
  • Torch
  • Ulf Jonsson
  • vasil
  • Vaxian
  • vladi mazzilli
  • wastehl
  • Weston
  • William Kim
  • William N.
  • William Stehl
  • Wesley Venis
The aforementioned have contributed financially to the continuing triumph of 4hv.org. They are deserving of my most heartfelt thanks.
Forums
4hv.org :: Forums :: Computer Science
« Previous topic | Next topic »   

reading data from a serial port?

Move Thread LAN_403
Solidacid
Fri Dec 05 2008, 05:12PM Print
Solidacid Registered Member #1430 Joined: Sun Apr 06 2008, 11:12AM
Location: Ã…rhus, Denmark
Posts: 102
hey everyone :D
i was hoping you could help me, im trying to built a temperature sensor for my serial port but i don't know how to send data to it.

i tried connecting 2 LEDs (in opposite directions) between pin 4 and 5 on the serial port, then i used This (from scitoys.com) program to send morse code to my serial port.
to my amazement BOTH LEDs started blinking?!

i serached around google for a while an found out that the serial port transmits data as both positive and negative pulses.

now, my question is: how do i send data TO my serial port? do i just plug some wires from a 5V source in some holes?
i would like to send binary numbers thru it.

it would be great if i could hook up 8 swithes (a DIP-switch?) and if i for example pressed switch 1,3 and 6 my PC would recieve 10100100

A DIP-switch:
DIP Switch


any ideas?
Back to top
Sulaiman
Fri Dec 05 2008, 06:36PM
Sulaiman Registered Member #162 Joined: Mon Feb 13 2006, 10:25AM
Location: United Kingdom
Posts: 3140
You could look at ic like MAX232
It would be a lot easier to use the parallel port though.
Back to top
Solidacid
Fri Dec 05 2008, 07:03PM
Solidacid Registered Member #1430 Joined: Sun Apr 06 2008, 11:12AM
Location: Ã…rhus, Denmark
Posts: 102
thanks for the reply!
i did i quick search for the MAX232 at my local(35 km away cry ) electronics stores website, the chip is pretty cheap amazed.

do you have any links or directions on how to connect it? or how to connect switches to the parralel port?

i played around with my parallel port a while back, i even made a small circuit to control a cellphone from it, so i could send text messages from my PC amazed.
it only used the outputs from the port though, i have no idea how to use the printer port inputs,
do i apply power to a pin or do i just connect a pin to ground?

as you said it would probably be easier to use the parallel port so ill try that first, but eventualy i would love to build a serial version for my laptop(using a USB to serial converter)
Back to top
LithiumLord
Fri Dec 05 2008, 09:46PM
LithiumLord Registered Member #1739 Joined: Fri Oct 03 2008, 10:05AM
Location: Moscow, Russia
Posts: 261
Solidacid wrote ...
do you have any links or directions on how to connect it? or how to connect switches to the parralel port?
Link2

It's not a serial-to-parallel convertor, it's just used to convert logic levels. You need an MC or a clocked logic-based device (a bit of an overkill here) in order to transfer information through this port.
Back to top
Solidacid
Sat Dec 06 2008, 12:17AM
Solidacid Registered Member #1430 Joined: Sun Apr 06 2008, 11:12AM
Location: Ã…rhus, Denmark
Posts: 102
LithiumLord wrote ...

Link2

It's not a serial-to-parallel convertor,
i know suprised, i meant directions on how to use the chip OR directions on how to connect a DIP-switch to my parallel port or preferably both ofcourse
Back to top
LithiumLord
Sat Dec 06 2008, 12:44AM
LithiumLord Registered Member #1739 Joined: Fri Oct 03 2008, 10:05AM
Location: Moscow, Russia
Posts: 261
Heh, what exactly are you going to achieve? The parallel interface just needs 0/+5v signals supplied to each pin through resistors that prevent bus collisions. For the serial, the chip you are looking at is a level matching device, meaning you rig it to your serial port with one side and to the controller you'll use with the other, take a look at it's datasheet - it's pretty clear there. Then - just watch the RS232 interface specs to make the timing procedures. For the temperature sensor you'll only need an ADC, an MC (most likely serving as ADC as most of them can) - and the 232 matching chip to communicate with the computer. If you'll choose the parallel port, just rig a parallel ADC to your LPT port with the collision-proof resistors present.
Back to top
Solidacid
Sat Dec 06 2008, 12:59AM
Solidacid Registered Member #1430 Joined: Sun Apr 06 2008, 11:12AM
Location: Ã…rhus, Denmark
Posts: 102
LithiumLord wrote ...

The parallel interface just needs 0/+5v signals supplied to each pin
That's what i needed to know :D i was wondering if i should just connect a data pin to ground or feed it 5v
Back to top
Bjørn
Sat Dec 06 2008, 02:50AM
Bjørn Registered Member #27 Joined: Fri Feb 03 2006, 02:20AM
Location: Hyperborea
Posts: 2058
You don't need to make it complicated, most rs-232 ports accepts 0-5 V instead of -12 - 12 V. The serial ports also have general input/output pins that you can use without thinking about rs-232 timing. The advantage with the serial port is that you don't need a driver in windows, since the driver is built in.

In the simples case you connect the sensor with a zener to limit the voltage to the general IO lines and make your program. Look at digital output sensors like DS1820 and SMT160 that can be interfaced without an A/D or rs-232 timing. One example (google has many): Link2

There are many ways to do it, you just need to decide on how complicated you want it to be and the accuracy you need.

Back to top
Conundrum
Sat Dec 06 2008, 06:34PM
Conundrum Registered Member #96 Joined: Thu Feb 09 2006, 05:37PM
Location: CI, Earth
Posts: 4061
modified surplus USB keyboard would work :)

also you can send a fair amount of data thia way, in fact i was looking into using it as a primitive A-D for laptops with no serial port.

regards, -A
Back to top

Moderator(s): Chris Russell, Noelle, Alex, Tesladownunder, Dave Marshall, Dave Billington, Bjørn, Steve Conner, Wolfram, Kizmo, Mads Barnkob

Go to:

Powered by e107 Forum System
 
Legal Information
This site is powered by e107, which is released under the GNU GPL License. All work on this site, except where otherwise noted, is licensed under a Creative Commons Attribution-ShareAlike 2.5 License. By submitting any information to this site, you agree that anything submitted will be so licensed. Please read our Disclaimer and Policies page for information on your rights and responsibilities regarding this site.