By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,480 Members | 1,146 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,480 IT Pros & Developers. It's quick & easy.

Newbe help. Sending serial data

P: n/a
ken
Hello everyone,
I'm new to visual VB and I am trying to setup communications to the
outside world. I found the example listed below in the help section of
Microsoft Visual Basic 2005 Express Edition. Using the Hyper Terminal
should I be able to see the string "Hello" or am I completely off base
here? Thank you in advance for all and any help.
Best regards, Ken

Sub SendSerialData(ByVal data As String)
' Send strings to a serial port.
Using com1 As IO.Ports.SerialPort = _
My.Computer.Ports.OpenSerialPort("COM1")
com1.WriteLine("Hello")
End Using
End Sub
Jan 13 '06 #1
Share this Question
Share on Google+
12 Replies


P: n/a
Only one computer can see a serial port at a time usually.
Sometimes you can find Serial Line Analysing tools that will
allow you to analyse and send at the same time,
however I've no idea how they work. I don't know
where you might find one that works with built in ports. I have used
some Moxa software that will allow you to do this, but it's hard to get
hold of.

The easier soloution is to have either 2 PC's where
you have the VB App sending on a Comm port
connected to a Comm port on the other PC running
Hyperterminal receiving the data.
OR
If your PC has 2 comm ports, connect one to the other
and You can then send on one with the VB App
and use Hyperterminal to receive on the other...

Hope this helps
Regards
Chris

Jan 13 '06 #2

P: n/a
Apologies that should read
Only one "Process" can use a serial port at a time usually
Your VB App would be that Process.

Jan 13 '06 #3

P: n/a
Here is the message you will get from HyperTerminal If
you try to read from a port that is sending
"Another program is using the selected Telephony Device
Try again after the program completes"

Jan 13 '06 #4

P: n/a
ken
Thank you theinvisibleGhost.
Jan 13 '06 #5

P: n/a
ken
Once again thank you for your help. I tried to connect my laptop to
the computer running my VB programming but, the Hyper terminal on my
laptop gets the message:
"Another program is using the selected Telephony Device
Try again after the program completes"
and I don't have anything connect to the laptop. Can you tell me how
to find out what program may be using it.
Regards, Ken
Jan 13 '06 #6

P: n/a
Intriguing! Usually you know when somethings using it!
I don't know if there is anyway of detecting what app may be using it.
Is the laptop running NT4?
I know there was some cases with certain older Dell Laptops getting
funny with comm ports. I remember we had one that would could
only be setup either for NT4, or for DOS but not both, through
some strange settings in the BIOS.
Hyperterminal would indicate your running 2k/xp?

All I can suggest is check that the Comm port is shown OK under
Device Manager, see if there are any IRQ Conflicts if you can.
I've just done a few searches and apparently some PCMCIA devices
do want to share IRQ's and cause problems..

I presume you've tried a restart to kill anything that may have been
running?

Failing all of that...
Have you got a floppy drive and an old dos boot disk lieing around?
If your confident you could boot your laptop into pure dos from the
floppy.
I've found some free software here:-
http://www.taltech.com/freesoftware/fs_sw.htm
called ComShow which by the look of it will do the same thing as
HyperTerminal which runs in DOS.
With Dos there's no worrying about drivers for serial comms, and it's
doubtful
that anything will conflict with them by default.
If on the other hand you've never touched DOS in your life that might
be a bit over the top,
in which case we'll try something else =)

Jan 14 '06 #7

P: n/a
Ah ha,
I have found a soloution for you!
http://www.sysinternals.com/utilities/portmon.html

This is acts like a serial line analyser.
You can run it on your VB comp to find out what your VB app is
outputing
on Comm1,
or you can run it on your Laptop and it might tell you which process is
using your
Comm Port =)
Hope that helps!
Regards
Chris (TiG).

Jan 14 '06 #8

P: n/a
ken
On 13 Jan 2006 16:16:14 -0800, "theinvisibleGhost"
<th***************@yahoo.com> wrote:
Intriguing! Usually you know when somethings using it!
I don't know if there is anyway of detecting what app may be using it.
Is the laptop running NT4?
I know there was some cases with certain older Dell Laptops getting
funny with comm ports. I remember we had one that would could
only be setup either for NT4, or for DOS but not both, through
some strange settings in the BIOS.
Hyperterminal would indicate your running 2k/xp?

All I can suggest is check that the Comm port is shown OK under
Device Manager, see if there are any IRQ Conflicts if you can.
I've just done a few searches and apparently some PCMCIA devices
do want to share IRQ's and cause problems..

I presume you've tried a restart to kill anything that may have been
running?

Failing all of that...
Have you got a floppy drive and an old dos boot disk lieing around?
If your confident you could boot your laptop into pure dos from the
floppy.
I've found some free software here:-
http://www.taltech.com/freesoftware/fs_sw.htm
called ComShow which by the look of it will do the same thing as
HyperTerminal which runs in DOS.
With Dos there's no worrying about drivers for serial comms, and it's
doubtful
that anything will conflict with them by default.
If on the other hand you've never touched DOS in your life that might
be a bit over the top,
in which case we'll try something else =)


Thanks for the reply,
I'm running XP on a HP and it was the modem on com3. I disable it and
my only options in Hyper Terminal were LPT and winsock, com3 wasn't
on the list anymore (strange). No cmom ports were listed. I checked
the device manager, no conflicts and the only port listed was LPT. Any
Ideas? I may have an old DOS disk around here somewhere but, I
wouldn't know were to begin to look. It's been years since I used DOS.
Mid 80's on my first 80386. I'll try the software from the link you
supplied and let you know how it works out. Regards, Ken
Jan 14 '06 #9

P: n/a
ken

Thanks for the reply,
I'm running XP on a HP and it was the modem on com3. I disable it and
my only options in Hyper Terminal were LPT and winsock, com3 wasn't
on the list anymore (strange). No cmom ports were listed. I checked
the device manager, no conflicts and the only port listed was LPT. Any
Ideas? I may have an old DOS disk around here somewhere but, I
wouldn't know were to begin to look. It's been years since I used DOS.
Mid 80's on my first 80386. I'll try the software from the link you
supplied and let you know how it works out. Regards, Ken
Jan 14 '06 #10

P: n/a
I suspect the Modem adds a comm port through the PCMCIA slot purely
for it's own means so theres no way you can use that one.
If theres no other comm ports shown in Device Manager, then I suspect
that it is disabled in the laptops BIOS. Have a poke around!
It should end up on Com1.

Jan 14 '06 #11

P: n/a
ken
Hi Chris,
Portmon (second link) for Windows NT/9x works great!!! Once again
thanks for all your help.
Best regards,
Ken

Jan 14 '06 #12

P: n/a
Your Welcome =)

Jan 14 '06 #13

This discussion thread is closed

Replies have been disabled for this discussion.