|
-
May 1st, 2006, 08:15 AM
#1
Thread Starter
New Member
Checking if hardware is connected
Hi all VB expert,
I have a problem with COM port connection problem. I try to look up a help from any VB forum, but I still can't find a solution. All the forum I found, just teach me how to detect the serial port available in the PC, but not testing on whether the port is connected with hardware. Is that possible to do? Please help. Thanks
-
May 3rd, 2006, 10:39 AM
#2
Thread Starter
New Member
Re: Checking if hardware is connected
Is that mean there are no solution for this problem? Why no body can help me here?
-
May 3rd, 2006, 10:57 PM
#3
Re: Checking if hardware is connected
Whether it's possible to detect whether your hardware is connected depends on what the hardware is. You can detect some hardware, but there's hardware you can't detect. What kind of hardware are you trying to detect?
-
May 4th, 2006, 09:05 AM
#4
Thread Starter
New Member
Re: Checking if hardware is connected
Actually, What I am try to do is checking whether the port is not connected, then I will try to let the user know that hardware (ie. barcode reader) is not exist. Using mscomm.portopen just tell me that I have a serial port 'COM1' in my computer, but not checking whether the port is connecting to the hardware or not.
-
May 5th, 2006, 11:44 AM
#5
Re: Checking if hardware is connected
Check the documentation for the reader - see if it will respond to any particular input. For example, a Hayes-compatible modem will respond to "ATI" with a certain string. If the reader does something like that, send the string it responds to and look for the proper response while a timer is running. If the timer times out (set it for twice as long or three times as long as it normally takes for the reader to respond), there's no reader connected.
If there's no string the reader will respond to, and it doesn't set any of the handshake lines, there's no way to tell if it's connected. (If it sets handshake lines you can tell that something is connected by checking the status bits, but you can't tell what the connected hardware is.)
-
May 8th, 2006, 04:19 AM
#6
Re: Checking if hardware is connected
You can check the DSR and CTS lines, if a harware device is connected to the COMM-port.
-
May 8th, 2006, 04:52 PM
#7
Re: Checking if hardware is connected
IF the device does any handshaking. Quite a few serial devices don't.
The most difficult part of developing a program is understanding the problem.
The second most difficult part is deciding how you're going to solve the problem.
Actually writing the program (translating your solution into some computer language) is the easiest part.
Please indent your code and use [HIGHLIGHT="VB"] [/HIGHLIGHT] tags around it to make it easier to read.
Please Help Us To Save Ana
-
May 9th, 2006, 05:19 AM
#8
Thread Starter
New Member
Re: Checking if hardware is connected
 Originally Posted by namrekka
You can check the DSR and CTS lines, if a harware device is connected to the COMM-port.
Thank you very much, you have solve my problem.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|