Check When Serialport Is REALLY Connected?

Mar 16, 2009

I want to send some data through a serialport (USB) permanently and got a problem once the USB interface crashes. Sometimes it just happens, but if I ask the PC "serialport2.isopen ()" I will get a TRUE, even though the USB cable was uplugged. How can I check if a connection is still available. CDHolding wasnt working either. I am using VB 2008 Express

View 7 Replies


ADVERTISEMENT

Change The .BaudRate Property Of A System.IO.Ports.SerialPort While It's Already Connected?

Nov 18, 2010

For whatever odd reason, we have a legacy data recorder device that runs at 9600 baud. Except when it needs to transfer its recorded data to a PC, in which case it switches to 57600 baud.

The old VB6 code worked, although it had its own set of problems of course.

The routine is this: Do several COMMAND/RESPONSE routines to populate a list of available records, listed by timestamp, at 9600 baud. Once a timestamp or several are selected, display a file save dialog. At the moment that dialog is closed, send a command to the device to tell it "hey we're going to warp", sleep for 100ms, then set the baud rate property of the persistent COM1 connection to 57600, before beginning to process XMODEM data and do the progress bar dance.

The problem I'm having is that it doesn't appear that the data received is ever really kosher as far as the byte marshaling is concerned. Which makes me wonder just how well SerialPort is at dynamically changing bauds on the fly. The VB6 version used MSComm.

I've even attempted to just use MSComm through the compatibility layer but "CTL_E is not supported" which makes it sound like it's incapable of doing XMODEM. (?)

View 1 Replies

SerialPort Escape String - Retrieving Data From A Device Connected To A Virtual Com-port

Aug 13, 2010

I am writing a small app that is retrieving data from a device connected to a virtual com-port. I connect without problems to the device using the settings 9600-8-N-1.

I need to send the command <esc>MS , the device then sends back the data to a computer. I have tried this using Hyperterminal with success. I also did this with Excel and VBA. I used the MSComm32 Active X control:

MSComm1.Output = Chr$(27) + "M" + "S" + Chr$(13)

Msgbox(MSComm1.Input)

This made the data from the device pop up in a messagebox. I am writing a winforms app in vb.net, using VS2005. I have a form, on which I have a Placed a SerialPort control, named sp. My sample code is as follows:

Private Sub Form1_Load(ByVal
sender As System.Object,
ByVal e

[CODE]...

This returns the error message "Error: expecting a command". I have done som tests in HyperTerminal, and have concluded with:

-If I dont send <esc>, I get error "Expecting a command"

-If I send wrong command (ie MD instead of MS) i get error "Bad command"

Based on this, I suspect that I don't pass the escape character correctly to my device. So I wonder how to do this?

View 5 Replies

Check If Connected To Internet?

Sep 22, 2010

I have no idea at all of how to get a simple True/False function to tell me if the user has any sort of internet connection

View 14 Replies

Check If Connected To Internet + Image Available?

Oct 18, 2010

Basically I want to have a picturebox which shows an embedded resource if not connected to the internet, and an online image if connected to the internet.I assume this can be done on the form load event, I just don't know the code for it. Basically this is the logic though:

-If 'http:/[url].... is available (therefore connected to internet)

-Picturebox1.Image = http:[url].....

-Else[code].....

How can I code that properly? Would putting it in the form load event work?

View 17 Replies

How To Check If Connected To The Internet Instantly?

Aug 23, 2011

How to check if connected to the internet instantly?

It must support proxi and windows xp,too.

View 1 Replies

Reliably Check If A User Is Connected Via The LAN?

Mar 6, 2009

I have a requirement that users be connected via the LAN for a small service I am writing. Simply check My.Computer.Network.IsAvailable isn't enough because that will detect any network (e.g. wifi). I need to check whether or the user is LAN connected (and can therefore connect to an Oracle DB)

View 1 Replies

How To Check If Successfully Connected In Ms Sql 2008 In Silverlight

May 17, 2012

i just want to ask about on how to check if i am successfully connected in ms sql 2008 in vb.net silverlight.

View 1 Replies

Check If A Computer Is Connected To Domain Or Only A Local Network?

Oct 27, 2010

i need to check if my Computer is connected with an Active Directory Domain or only in a Workgroup. Is this possible?

View 4 Replies

How To Check Remote Server Connection Status Connected Or Not

Dec 27, 2011

I am Using Visual Basic 2010. I want to check My Connection Status. Connected or not in Remote Server Connection (SQL Server 2008 R2). How To Check Connection Status..?

View 1 Replies

VS 2008 - Check If Client Is Connected To The Server By Starting A New Thread?

Sep 24, 2009

I need to check if my client is connected to the server by starting a new thread. So in short I need a way to know if the client is still connected to the server.

Here is my

[code]...

View 13 Replies

Changing ToolStripStatusLabel Text To Connected If Connected To A Network

Apr 4, 2011

On my program I am trying to make a ToolStripStatusLabel's text change to "connected" if connected to a network and if not connected to a network change the text to " Not Connected" then I don't know how to display a image if connected to a network or not connected. So if the computer is connected to a network I have a image that I would like to be displayed next to the ToolStripStatusLabel. And if not connected to a network, can the program display a different image? I tried this:

My.Computer.Network.IsAvailable=True(ToolStripStatusLabel2.Text "Connected")
My.Computer.Network.IsAvailable=False(ToolStripStatusLabel2.Text "Not Connected")

View 6 Replies

Find Out If The Connection Of Sockets (TCPClient) Is Connected Or Not Connected

Nov 10, 2009

I am trying to find out if the connection of my sockets (TCPClient) is connected or not connected. I am using the following code:

[Code]...

View 3 Replies

Get Caller ID From Serialport

Apr 23, 2011

I am trying to read caller id from a internal modem. modem is caller id enable and it works in hyper terminal. but when i try from vb.net it only shows 'RING'. here is my full code

[Code]...

View 4 Replies

No Timeout For Serialport?

Dec 16, 2011

I am using VB 2005 and need to trap a serial port timeout. I use a standard try/catch block, but if no characters arrive the code still hangs at the ReadByte call. Here is the code:

Try
SerialPort.ReadTimeout = 200
' read timeout of 200 mSecs
thisByte = SerialPort.ReadByte()

[code]....

View 5 Replies

USB SerialPort Oddities .Net 4.0?

Jul 12, 2011

Recently while trying to help someone with an issue using USB SerialPort's I discovered sometheing interesting when the ports Handshake was set to RequestToSend. My setup COMx <---> BreakOutBox <---> COMy COMx and COMy are on the same PC. The breakout box is used to create a null modem, pins 2 & 3 crossed, pin 20 to pin 6.When the handshake was set to RequestToSend every Write resulted in Carrier Detect and Ring being raised. Is this just my adapter or are all USB SerialPorts like this?Serial Port Random Microsoft® Community Contributor 2011

View 2 Replies

VS 2008 PDA SerialPort?

Jun 23, 2010

I have wrote this program (for PDA), to connect a PDA to the PC via RS232.It only works half way.

If I send anything from the pda to the pc, I receive data correctly.If I send anything from the pc, then the pda hangs up.Can anybody tell me what I'm doing wrong?

Also, how do I make sure the port on PDA is closed when quitting the application?

[Code]...

View 1 Replies

Asp.net - Serialport Communication .net 4.0 From A Webpage?

Sep 23, 2011

Looking for serial port communication using ASP.NET 4.0. I have a cardwriter/reader from IDTECH which talks through a comport. Is there any way to accomplish with .net through the web.

I read things but most of the topics on speaking about .net 2.0 and I was not sure if they created something to handle this in .net 4.0

View 2 Replies

Bug In Serialport Control When Using E - 8 - 2 Parameters?

Jun 16, 2011

We have been debugging a problem with serial communications with an embedded device on 115200 baud, Even parity, 8 databits and 2 stopbits. The problem: a lot of extra 0x00 are sometimes received from the serialport.

1) We build a real basic sample program that only handles the data exchange. It was completely build according the serial-port-vb.doc from msdn. It was build in vb.net 2010. So this was the most basic setup possible on the PC side. This simple tool clearly shows the datareceived event spitting out extra bytes.

2) We used a scope to look at the hardware bits/levels. No problems / differences seen between good and bad messages. No extra bytes visible that the serialport event send to our programm.

3) We tapped the serial communication and received no wrong data on the tapping system but still on the .net tool. Again the serialport datareceived event gave us many extra 0x00 bytes.

So our only possible conclusion is that there is a problem in the serialport component from .net. My question: Are there any know issues? Can I get in contact with a microsoft engineer?

View 9 Replies

Communications :: Use The SerialPort In VB Express?

Jan 27, 2009

how to use the SerialPort in Visual Basic Express?

I have this in the Serial Port Data Recieved event

Code:
SerialText = SerialText & SerialPort1.ReadChar
TextBox1.Text = SerialText

I get : Cross-thread operation not valid: Control 'TextBox1' accessed from a thread other than the thread it was created on. As soon as the event is triggered.

I'd like to display the recieved info in a textbox and transmitt info as well, but I don't know how...

View 4 Replies

Odd SerialPort Names Which Do Not Work

Jan 7, 2011

i am coding a tool which is able to connect GPS devices over the IO.Ports.SerialPort function in .NET..Everything works fine, but to list all available COM interfaces it looks like: [code] its impossible to connect to a device which is called COM3°. If i simply try to connect manually to COM3 it works perfect. [code]

View 3 Replies

Safe To Use A Synclock On The Serialport?

Aug 3, 2009

I have an application that requires several threads, otherwise the main UI thread would end up frozen.i am after a little advice as i have not really don alot of threaded applications.

First Question;

I have a thread which handles data coming in from the serial port( this wil become much more complicated), is it safe to use a synclock on the serialport object : -

[code]...

View 3 Replies

SerialPort DataReceived Event On EOF?

Jul 21, 2009

Im using VB express 2008 (compiled with .NET 3.5) to write a program that communicates with a USB device. The USB device is a communication class device and thus will emulate the usual rs232 serial port once attached to the PC. The USB device sends a fixed number of bytes and i have set the threshold received byte property to this value. I have run the program and it seems to read the USB device "correctly" but when i debug the code, i realise that the datareceived event of the serial port gets fired on the eventtype = EOF. I am using the Read function to read the bytes from the serial port and the Newline property is set to "" (but i thought that this is irrelevant if im not using ReadLine). When the datareceived event fires with EOF, the Read function blocks until one byte arrives, reads it and calls the function that processes the data. I went through the forum and realised that the EOF eventtype is no longer supported, is this true? I dont think that getting this eventtype is logical anyways in my case.

View 5 Replies

SerialPort Timer_tick BUG Or Code

Apr 3, 2010

I'm trying to enable a timer within a SerialPort.PinChanged even is reached but the timer tick even never starts. Has anyone ever tried this? I am using vb.net 2008 express so I dont know if that is the issue or not.

[Code]....

View 9 Replies

Serialport.Readexisting Different Behavior?

Mar 10, 2010

I'm using the following to read a serial port. When run it displays the data correctly but stepping through the program I find that it loops through the serialdatarecieved event for each character of the port input rather than reading all of it. So _msg only equals one letter at a time. I'm trying to set a variable equal to the entire input stream but only get one character of it.The end goal is to capture all of the data available on the port when the event triggers so that this data can then be processed. I tried using the bytestoread function, which gets the correct number of bytes to read, and then looped through to read a byte at a time but that didn't seem to work as I expected either. It just kept reading the first byte.

Imports System.IO.Ports
Public Class CommTest
Dim WithEvents SerialPort As New SerialPort

[code]....

View 3 Replies

Using .net To Connect To Gsm Modem Via Serialport?

Apr 7, 2011

I am doing a sms project using VB .net to connect to my gsm modem via serialport. All the connection and everything was working great and I can send and receive sms. Then here come a problem, I need to send long sms more than 160 chars. I read and did some research and I know that I need to use the pdu and udh. I managed to understand slightly of the pdu packet but is still quite confuse on that part.

Anyone can briefly explain the exact way to do the concatented sms (long sms)?Another problem is how can I use vb to encode the data into pdu gsm 7bit data? Is there any built in functions or do i need to write them myself?

View 1 Replies

VB 2008 On XP Exception With Serialport?

Mar 14, 2009

I am trying to access a printer via the serial port in VB Express 2008. I wrote a small prog with buttons on the form to exercise the escape codes in a Windows Vista 32 laptop with a USB to serial adapter. Only 3 codes worked, BEL, reset and a printer specific command. Also, when i try to receive data, it justs times out. So, I tried to move to a WinXP machine with real serial ports. The program now has an illegal argument exception and the message is to the effect that the name of the port for the property portName does not start with COM/com. Which is very puzzling because I did verify the portname and it is com1.Is this a known issue or am I doing something wrong? The form works on Vista but not in XP.

[Code]...

View 8 Replies

Vendor & Product ID Using SerialPort?

Apr 4, 2012

I am writing a program which detects a development board I designed which communicates with an FTDI chip. Right now my program scans any COM ports and generates a list, which the user will then choose from and connect with that device. The problem is that I want to isolate that list to only the devices which I designed. The FTDI has a unique manufacturer and device ID, but I only know how to access this data 'the old fashioned way' (i.e. through device manager).

What I would like to know how to do is determine the VID and PID of a COM port from VB, so I can dynamically get rid of any devices which do not meet the proper requirements and thus my list will only show the correct devices.

View 13 Replies

VS 2005 SerialPort Control

Aug 21, 2009

I'm working on application which uses SerialPort Control to send/receive commands to/from microcontroller.

Here is the basic

CODE:

I maybe missing something because the reaction of microcontroller very accidential! I mean, sometime it works from the first click and sometime from the third... I must make a number of clicks until it reacts back!

View 1 Replies

VS 2008 SerialPort Hang-up?

Jun 23, 2010

I am trying to send and receive data using the SerialPort component. I am sending data to an Texas Instruments MSP430 which simply echos the sent character. I wanted my VB solution to read characters from a file, send a single character, and wait until the echoed character is received before sending another.

I have been fairly successful thus far but I have run into a little catch. When I attempt to send large files (323505+ characters) my MSP430 just hangs there and will not receive any more characters. My VB app return to VS '08 with timeout errors (timeout set to 1 minute).

I wanted to post my VB code here to see if the problem is from my VB app. I will be posting this problem on the IT usergroup to sort out anything on the MCU end. Here is the pastbin of the data write and the data receive subs:[URl]..

View 2 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved