Newbe help. Sending serial data

K

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
 
T

theinvisibleGhost

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
 
T

theinvisibleGhost

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

theinvisibleGhost

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"
 
K

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
 
T

theinvisibleGhost

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 =)
 
T

theinvisibleGhost

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).
 
K

ken

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
 
K

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
 
T

theinvisibleGhost

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.
 
K

ken

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top