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


ADVERTISEMENT

App To View Which COM Port A USB-Serial Device Is Connected To?

Jul 14, 2011

I am currently having an issue finding information on how to develop a simple application that a user can run to find out which COM port ie. COM1, COM2, ect is assined to the Belkin USB to Serial Adapters we use in the company.

To anyones knowledge is this possible and how would I implement it in a Windows Form Application.

View 15 Replies

Read Data Through The Virtual COM Port Created By Bluetooth?

Oct 25, 2010

Trying to read data through the virtual COM port created by bluetooth.

The original console program (and the trimmed version below) was designed to read data from serial port COM1 and output the data to notepad. The program works; hook the bar code reader to COM1, activate bar code reader, swipe card, bar code reader beeps, data input collected from COM1 and sent out to notepad.

The problem: Bluetooth is wanted instead of serial cable.

We disconnected the serial cable, we connected a USB bluetooth receiving device onto the XP. XP installed the bluetooth device drivers 'Generic Bluetooth Radio' and 'MS Bluetooth Enumerator'. Bluetooth detected the bar code reader device and created COM5 outgoing SPP slave and created COM6 incoming.

But now; activate bar code reader, swipe card, bar code reader beeps, NO data input collected from COM5.

[Code]....

View 7 Replies

Receiving Invalid Data From Serial Port Using SerialPort.ReadExisting

Jan 16, 2010

Recently we have connected one bluetooth device which receive data from our serial device. The bluetooth device further transmite this data to a Windows Mobile which is bluetooth enable. Baud rate of whole system is 19200 with 7 data bit and 1 stop bit.When we send command to serial device through bluetooth device it is accepting the command and respond accordingly. but some of data byte of string is desplay as question mark (?).But in case we connect the serial device directly to PC, the string received is correct.[code]Response given by Serial Port is "?09?D03?A D?

View 1 Replies

Receiving Invalid Data From Serial Port Using SerialPort.ReadExisting()

Jan 16, 2010

Recently we have connected one bluetooth device which receive data from our serial device. The bluetooth device further transmite this data to a Windows Mobile which is bluetooth enable. Baud rate of whole system is 19200 with 7 data bit and 1 stop bit.When we send command to serial device through bluetooth device it is accepting the command and respond accordingly. but some of data byte of string is desplay as question mark (?).[code]...

View 4 Replies

Simulating Click On Human Interface Device And Retrieving Data

Apr 7, 2010

I have USB device that is detected as human interface device (HID). The device has one button on it. I want to have more of same devices attached to one PC. I would like to simulate a click on that device (it is not a mouse!). It should be simple using Windows API, but I just can't seem to find an example or at least function that does that (I successfully found code that takes position of a MOUSE, and sends click to a MOUSE, but I need that for my HID). What i really need is an example how to simulate click on HID (something like joystick).Second question is a bit more complicated and I can't find a solution. The HID when button is clicked returns data (5-6 bytes). But data returned is immediately printed to the screen (like i typed it on keyboard) and it is followed by CR, however no data is left on clipboard. I don't know how to get that data to my program. Detecting keystrokes using Windows API (something like keylogger), or to make a control (richtextbox) and retrieve data from that control? Thou important notice is that my program is complicated, involves multithreading (cross-thread operations are a mess) and is TIME CRITICAL (as much as it can be on Windows - you get what I mean), so cross-thread access of control will slow me down a lot or even just won't work. Something like this:[code]Even if this problem is solved it still makes it buggy because user should be able to use GUI all the time.

View 5 Replies

VB 2003 - Handling Data - Transmitting Data From A Comm Device Via Serial Port

Nov 10, 2009

I'm currently working on a project where I am transmitting data from a comm device via the serial port and resorting the raw data (in binary) to its respective ascii values. The problem I'm facing is determining the most efficient method to accomplish my goal. Essentially, I have 68 bytes coming in, the first and second bytes represent the page and packet number and the data itself ranges from 3 to 64, the remaining for my checksum.

What I am needing to do is, grab 50 consecutive bytes per variable in my array, and that is where I'm confused. I have easily pulled my 3-64 bytes and stored that data to a string. I just don't know the most efficient method to accomplish my goal. Should I write directly to file all my data, as there are like 8 pages, of 128 packet data. [Code] I can capture the the first 50 by using a for-loop easily, but what would be the preferred method to track what data chunk I've taken? The more I think about it, I think I may just want to write to file, all my data, and then just take them back to back in 50 byte chunks. Is that the most efficient method?

View 3 Replies

Open A Communications Port And Read Data From A Wired Usb Device?

May 16, 2011

I know how to open a communications port and read data from a wired usb device.

How can I open a communications port to read data from a wireless bluetooth device?

View 5 Replies

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

Get FullName From Available Serial Port (Com Port) From Device Manager In Windows Form With .net?

Jul 25, 2011

I have a Windows form.in windows form have a combo box that give me a list of available port serial with it code (Dim ports As String() =SerialPort.GetPortNames())for example( Com1,Com8,Com15,...).but I want to give me fullname of serial port in device manager for example in dvice manager is these (Comunication Port(COM1) - Printer Port(LPT1) And USB Serial Port(COM8)).how to Get it?

View 2 Replies

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 Object - Sending Command To Slave Device?

Jun 12, 2009

I am having a little trouble with the serialport object in VB2008. I have a program that will send a command to the slave device however the program will not read the data from the slave device. I know my computer is communicating with the slave device because in hypertem it has no problem. For example I send the word "AT" and I should get back a response of "OK",

View 9 Replies

Detect A Usb Device When It Is Connected To PC?

Feb 2, 2010

I need to detect a usb device when it is connected to PC.I found next code that is working. But it works only with Mass Storage.

Imports System.Management
Public Class Form1
Private WithEvents m_MediaConnectWatcher As ManagementEventWatcher
Public USBDriveName As String

[code]....

View 1 Replies

Detect If A Device Is Connected?

Sep 6, 2009

I am trying to figure out how to detect if a device is connected. The exact c# sample can be found here: [URL]

But when I tried to convert it to C# .... I wasted hours!

I googled a lot and changed the declaration of the API many times...

View 3 Replies

Detect When A New Usb-device Is Connected?

Mar 27, 2009

I want to detect when a new usb-device (can be anything) is connected to the computer. I don't need to know what kind of device it is, I just want to know when it is plugged in.

I found this thread: [URL]

I know the solution is in here, but I'm overlooking it I'm afraid. What I want:

USB-device connected > Run function. USB-device disconnected > Run another function.

View 1 Replies

Have Computer To Tell Usb Connected Device?

Feb 3, 2012

How to have the computer to tell the usb connected device what to do.

View 1 Replies

USB Device Connected Status?

Dec 21, 2011

I need to be able to get the status of a USB device ( Connected/Disconnected ). The device is a tablet. The device IS NOT a storage device, and no other operations will be performed. I am using Visual Studio 2010 and coding in VB. Everything i have found was for storage device or was old code.

View 7 Replies

Access A Connected Zune Device?

Aug 10, 2010

I was just wondering if you could view the items on a connected Zune device (such as the Zune HD or any of the others. (4GB, etc.))Also, possibly listen to the songs / watch the videos on it with the Windows Media Player codec in the program, and view the pictures in a PictureBox? Is this possible at all? Can I at least view the items? Or is this strictly forbidden?

View 3 Replies

Send Command To Device Connected To COM1?

Feb 3, 2012

I want to send a simple command, such as "v20" followed by a carriage control character, to a heating/cooling block connected to a desktop computer running Windows XP. I am able to get the commands to work within a terminal emulator. I want to compile a simple program that will be executed by software used to control a liquid handling robot.I've looked at the how to send strings to serial ports in visual basic page and modified that code ever so slightly to send the data that I want. However, it does not work and my heating/cooling block is not changing temperatures.

Here's what I have written:

Sub SendSerialData(ByVal data As String)
data = "n65"
' Send strings to a serial port.

[code]....

View 3 Replies

Catching And Removing Escape Characters In A Serial Comm Port Program?

May 18, 2010

I have recently developed a serial port communication program to access my hardware firewall and its connected to the device via a converter usb to rs232head plugged to a rs232 to an ethernet cable. this ethernet cable then plugs into the device console port.

my program functions similar to that of TeraTerm. an opensource hyperterminal program written in C++ but i decided to do one for vb.net

Alright to cut the story short, i have successfully coded out the program to accept incomming data from the device but however, i'm also receiving ansi escape sequence along with it and i have no idea how i could implement codes to remove these. i have spend 3 weeks trying to look for vt100 emulation codes written in vb.net but i found none so far. most are written in c++. here's an image to illustrate the problem which im facing.

The image below is a screenshot taken when the i ran both the programs together. The bottom is tera term 3.1 and the top is my vb project which i made using msdn's example and improved on the codes. basically tera term was able to interpret those escape sequence and display accordingly to that of the vt100 terminal display. I have spent time reading on regular expressions using the inbuilt function regex in visual basic and tried parsing some strings but its not working. i guess its far more complex than i thought.

View 6 Replies

C# - Find Through Which Network Device User Is Connected To Internet?

Apr 1, 2011

Using the code below i will get all network interfaces wich are enabled and functional on the machine.

Private netIntrfc As NetworkInterface() = NetworkInterface.GetAllNetworkInterfaces()
For i As Integer = 0 To netIntrfc.Length - 1
If netIntrfc(i).OperationalStatus = OperationalStatus.Up Then

[code]....

But my problem is how to get the default one, the one(ethernet adapter) through wich user is connected to internet?I need to change some settings of default(through wich user is connected to internet) adapter. settings i change through registry so i could sample add same settings for each network interface but that could cause problems and makes no point then?

EDITED:for now i have done like code below, so if this can help someone other...

Dim u As UdpClient = New UdpClient(System.Net.Dns.GetHostName, 1)
Dim localAddr As IPAddress = CType(u.Client.LocalEndPoint, IPEndPoint).Address
Private netIntrfc As NetworkInterface() = NetworkInterface.GetAllNetworkInterfaces()

[code]....

View 1 Replies

File I/O And Registry :: Detect A Mobile Device Has Been Connected To Pc

Jul 20, 2009

I posted the message below in the VB6 section of this forum with no success, but as I've now got access to VB2008 via work, I thought I'd try again here. Basically I'd like to be able in code navigate to a folder held on a mobile device like a mobile phone connected to a pc using MS Activesync? It shows up in the drive list within "My Computer" as a system folder, I've vb6 code to detect all the drives including network mapped drives but not the mobile device.Ultimately I'd like to do file copying when my program detects a mobile device has been connected.

View 1 Replies

VS 2008 Program Autorun When Removable Device Is Connected?

May 18, 2010

I'm not sure if this would be this right place to post this, or even if I should go about trying to do it through my program itself or through the computer's settings on the final EXE file, but anyways, here goes.

I have a synchronization program that syncs my flashdrive to my home computer and (hopefully) my flashdrive to my personal folder on the school computers. What I think would be easiest, though, would be if the program was located on the flashdrive, and would simply "autorun" when I plug it in, instead of having 2 separate instances of the sync program running at school and at home.

Would it be easier (or possible) to code for that from within the program, or with the EXE file's settings?

View 5 Replies

Create A Virtual Serial Port?

Aug 19, 2010

How do you create a virtual serial port using vb.net

View 1 Replies

How To Open Virtual Serial Port

Feb 25, 2009

I wrote a program that uses the following class from that site: VB.NET Tutorials - Serial Port Communication In VB.Net. The problem is that I cannot open a virtual serial port, and the second is that I want to make the communication asynchronous.

This is the subroutine which reads from the port:
#Region "comPort_DataReceived"
''' <summary>
''' method that will be called when theres data waiting in the buffer
''' </summary>
''' <param name="sender"></param>
[Code] .....

View 10 Replies

Virtual COM Port Fails To Open?

Jan 10, 2011

I have a few USB devices that use standard Microsoft Virtual COM Port drivers. More specifically, I believe they use the "Usbser.sys" driver. Whenever I plug my USB devices in, they always shows up in the Device Manager as a COM port, however, sometimes I am unable to open that COM port. This problem occurs on both Windows XP SP3 and windows 7 machines (The only operating systems I have tested this on).

To be a little clearer, I can plug my USB device in, and then successfully open the COM port. I unplug my USB device, then plug it back in, and I am unable to open the COM port. The only solution to this problem is to restart my PC. Is there any solution in VB.net to reset any entrees made to the Windows system when the USB device is plugged in? Has anyone come across this problem and resolved it via a VB.Net solution?

View 10 Replies

[2008] Opening A Virtual Com Port?

Jan 23, 2011

I need to communicate with a BlackBerry cell phone, so that I can query the current signal strength using Hayes AT commands, and store is into a file, along with my current GPS position.

I already got it to work perfectly using HyperTerminal:

- I installed BlackBerry Desktop Manager and I leave it running on the PC (otherwise it does not work!)

- I connect my BlackBerry Bold cell phone to the PC using a USB cable.

-The cell phone appears on the PC as a Virtual Com port, in my case it shows up as "COM13".

- I open HyperTerminal and connect to COM13 at 115200 bauds, 8 bits, 1 stop bit, hardware flow control

- If I type "AT" + ENTER, the phone answers "OK"

- If I type "ATI1" + ENTER, the phone answers with its model number "Platform: X.X.X.X, App version: X.X.X.X, PIN: XXXXXXXX"

- If I type "AT+CSQ" + ENTER, the phone answers with the current signal quality value "+CSQ: 21,99".

In theory it should be a piece of cake to query my phone using a serial port routine in VB.NET. The problem I have is that VB.NET allows me to read data from a REAL COM PORT, but refuses to read anything from a VIRTUAL COM PORT. When opening "COM13", I get "The given port name does not start with COM/com or does not resolve to a valid serial port. Parameter name: portName".

I did a lot a searching on Virtual Com Port on the WEB, but everything I see allows me to create a virtual com port. I only want to read an existing VIRTUAL COM PORT, not create a new one.So, I do I actually open a VIRTUAL SERIAL PORT, so that I can send the "AT+CSQ" command and receive my cell phone signal strength value using VB.NET?

View 5 Replies

Identifying A Device By Retrieving Its USB ID?

Feb 24, 2010

I'd like my application to be able to detect a where a particular USB device has been mounted, and adapt accordingly. Ideally, I'd associate paths with a USB serial number, rather than with a given path. However, I cannot figure out a simple way to access these unique IDs from VB.Net code.

View 1 Replies

Communications :: Setup A Virtual Serial Port

Jul 4, 2008

I'm writing an app with takes 3 readings off LCD displays via serial ports. The module which scans the serial ports is getting stuck in a loop for around 1.5 seconds. I need it to be much quicker than that. Is there a way I can setup a virtual serial port so I can run test it on my PC. Its very tedious and time consuming of making changes and visiting the machine its for.

View 1 Replies

Make Virtual Serial Port Component?

Mar 26, 2009

I've been struggling with writing my own Ethernet to serial program and just about to give up since I'm down to the wire on this project. I keep getting intermittent errors and I just can't get around them.

View 3 Replies







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