Welcome
Username or Email:

Password:


Missing Code




[ ]
[ ]
Online
  • Guests: 61
  • Members: 0
  • Newest Member: omjtest
  • Most ever online: 396
    Guests: 396, Members: 0 on 12 Jan : 12:51
Members Birthdays:
No birthdays today

Next birthdays
11/25 Chris (39)
11/25 JamesH (17)
11/25 Oakley (21)
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 »   

Port access in VB 2005

Move Thread LAN_403
cjk2
Sun Feb 19 2006, 02:41AM Print
cjk2 Registered Member #51 Joined: Thu Feb 09 2006, 04:17AM
Location:
Posts: 263
Hi all, I would like to try interfacing my TV with my computer and I would like to use a VB program to do it.
My question is: Is it possible to make a serial/parallel port I/O line high and low on command? If so how can I do this in VB 2005 express?
Back to top
Bjørn
Sun Feb 19 2006, 03:22AM
Bjørn Registered Member #27 Joined: Fri Feb 03 2006, 02:20AM
Location: Hyperborea
Posts: 2058
The most important question is, what do you want to interface to the ports? A relay or an IR LED?

You can open a serial port like this:
Dim myPort As IO.Ports.SerialPort = New IO.Ports.SerialPort("COM1", 19200, False, 8, 1)

You then have two pins you can control like this:
myPort.RtsEnable = True
myPort.DtrEnable = False
Back to top
cjk2
Sun Feb 19 2006, 03:33AM
cjk2 Registered Member #51 Joined: Thu Feb 09 2006, 04:17AM
Location:
Posts: 263
I would like to be able to use my computer as a remote if it's not too hard to do. I would probably end up using an optoisolator and battery to turn an IR sender module (38khz or 40khz carrier frequency) on and off to send the signals for power, mute, channels, volume, etc.
Back to top
Bjørn
Sun Feb 19 2006, 03:38AM
Bjørn Registered Member #27 Joined: Fri Feb 03 2006, 02:20AM
Location: Hyperborea
Posts: 2058
To control the LED with perfect timing you need to shut down multitasking and disable interrupts, it is generally a bad idea. Instead of the IR module, use a microcontroller that does all the timing. If you really want to make an all software solution then it is possible but it is ugly and rather involved.
Back to top
Carbon_Rod
Sun Feb 19 2006, 04:34AM
Carbon_Rod Registered Member #65 Joined: Thu Feb 09 2006, 06:43AM
Location:
Posts: 1155
As easy as hit "play" on a sound card...
Link2
Prep your wav files and just use sound player OLE. ( 10 min or less )

The sniffer is easy to make this way too (Line in.) And gives a nice wav to study. Many projects you will find on the net will not work with the hardware. This way is the only 100% sure fire way to get your times and codes right (unless you have a nice digital scope at home.)

Tip: Sony IR units are very easy to code. Where as Sharp etc. may need a bit more work.

There are also a few GPL apps (only linux and old PalmOS last I checked) that trick an irda port into reading the codes.


Or one could always link the LPT port to a working remote button pads with some simple driver logic and some jumpers.

B)
Cheers,
Back to top
cjk2
Sun Feb 19 2006, 04:48AM
cjk2 Registered Member #51 Joined: Thu Feb 09 2006, 04:17AM
Location:
Posts: 263
Well the code seens to be good but I still cant seem to make it work. I checked voltages on all the pins of the port as I clicked the buttons, and no voltages changed.
Heres what I used:
Public Class Form1
    Dim myPort As IO.Ports.SerialPort = New IO.Ports.SerialPort("COM1", 19200, False, 8, 1)

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        myPort.RtsEnable = True

    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click

        myPort.RtsEnable = False

    End Sub
End Class



Edit: I may try that as well. Thanks Carbon Rod. I would still like to see if I can use a serial port as the audio line is already in use.
Back to top
Bjørn
Sun Feb 19 2006, 05:21AM
Bjørn Registered Member #27 Joined: Fri Feb 03 2006, 02:20AM
Location: Hyperborea
Posts: 2058
Hardware handshaking may be turned on by default and overriding your code. Try to turn it off.
Back to top
Carbon_Rod
Sun Feb 19 2006, 06:12AM
Carbon_Rod Registered Member #65 Joined: Thu Feb 09 2006, 06:43AM
Location:
Posts: 1155
This is some very old MS VB5 code.
(it uses the MSCOMM control)

A small test app...

]1140329549_65_FT1457_serial.zip[/file]
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.