- In addition to this, each serial communications device needs an interrupt request number (IRQ) and these numbers are limited in a PC. The end result is that although things look okay, you may still be having trouble with your communication port. On most desktop PCs, you will find two serial (COM) ports. Older systems often have one 9-pin serial.
- Web resources about - Serial Port Communication - asp.net.web-forms Communication - Wikipedia, the free encyclopedia) is the activity of conveying information through the exchange of ideas, feelings, intentions, attitudes, expectations, perceptions or commands. VoIP Business, VoIP Technology, VoIP Security - Fierce Enterprise Communications.
We were then introduced to .Net 1.1, VB programmers loved the fact that Visual Basic had finally evolved to an OO language. It was soon discovered that, with all it's OO abilities, the ability to communicate via a serial port wasn't available, so once again VB developers were forced to rely on the MSComm Control from previous versions of Visual Basic, still not that big of a deal, but some were upset that an intrinsic way of serial port communication wasn't offered with the .net Framework. Worse yet, C# developers had to rely on a Visual Basic control and Namespace if they wanted to communicate via serial port.
Then along comes .Net 2.0, and this time Microsoft added the System.IO.Ports Namespace, and within that was the SerialPort Class. DotNet developers finally had an intrinsic way of serial port communication, without having to deal with the complexities of interoping with an old legacy ActiveX OCX control. One of the most useful methods in the SerialPort class is the GetPortNames Method. This allows you to retrieve a list of available ports (COM1,COM2,etc.) available for the computer the application is running on.
Now that we have that out of the way, lets move on to programming our application. As with all application I create, I keep functionality separated from presentation, I do this by creating Manager classes that manage the functionality for a given process. What we will be looking at is the code in my CommunicationManager class. As with anything you write in .Net you need to add the references to the Namespace's you'll be using:
using System;
using System.Text;
using System.Drawing;
using System.IO.Ports;
In this application I wanted to give the user the option of what format they wanted to send the message in, either string or binary, so we have an enumeration for that, and an enumerations for the type of message i.e; Incoming, Outgoing, Error, etc. The main purpose of this enumeration is for changing the color of the text displayed to the user according to message type. Here are the enumerations:
#region Manager Enums
/// <summary>
/// enumeration to hold our transmission types
/// </summary>
public enum TransmissionType { Text, Hex }
/// <summary>
/// enumeration to hold our message types
/// </summary>
public enum MessageType { Incoming, Outgoing, Normal, Warning, Error };
Re: Serial port communication in asp.net We will use something similiar. My method would be write a windows service running in background and handing with serial communciation or TCP/IP, UDP and link functions to a database. Serial communications can be done via either direct to physical serial port connected to the computer or via a USB to serial converter interface. If the device do require a serial port and your computer don’t have any, you can make use of such converters easily.
Similar Messages:
Forms :: Serialport Communication - Receive Data To Pc From External Hardware
Sep 5, 2009i want to receive data to my pc from external hardware but i don't know how to do it since i am new to vb.net. the code in vb.net to receive data using serial port rs232.
Get USB Control For The USB Port Communication? Like The SerialPort Control For The COM Port
Jul 17, 2009Do someone know if there is a USB control for the USB port communication? like the SerialPort control for the COM port.
Url - Open Webpage (or Snapshot Of Webpage) Into Another Webpage
Mar 10, 2010i have an aspx page with vb.net back end. in that page i get names and url's from the database depending on different conditions. My requirement is that when i get the url, the code should then use that url and have that webpage in a small preview form on my existing aspx page. so basically i have a table as follows -
[Code]...
VB - Put The Player On The Webpage And Put The Webpage On The Sever It Cant Play The Video ?
Jan 13, 2009I making a webpage with the help visual basic. I wanted to put a flv video in it and i used flash control for asp.net serial-port-communication-asp-net.html. I made the player in flash told it to download the video from the sever. Now when i put the player on the webpage and put the webpage on the sever it cant play the video. But when i just pres the the player which is in swf format it works. It can download the video. But when i put the player on my webpage it cant.
Convert An ASP Classic Webpage Into An ASP.NET Webpage?
May 6, 2009Duplicate:good references or tools available for converting from ASP to ASP.NET?How i can convert an ASP Classic webpage into an ASP.NET webpage?
Get Caller ID From Serialport
Apr 23, 2011I 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]...
No Timeout For Serialport?
Dec 16, 2011I 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]....
USB SerialPort Oddities .Net 4.0?
Jul 12, 2011Recently 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
VS 2008 PDA SerialPort?
Jun 23, 2010I 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]...
Bug In Serialport Control When Using E - 8 - 2 Parameters?
Jun 16, 2011We 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?
Check When Serialport Is REALLY Connected?
Mar 16, 2009I 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
Communications :: Use The SerialPort In VB Express?
Jan 27, 2009how 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...
Odd SerialPort Names Which Do Not Work
Jan 7, 2011i 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]
Safe To Use A Synclock On The Serialport?
Aug 3, 2009I 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]...
SerialPort DataReceived Event On EOF?
Jul 21, 2009Im 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.
SerialPort Timer_tick BUG Or Code
Apr 3, 2010I'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]....
Serialport.Readexisting Different Behavior?
Mar 10, 2010I'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]....
Using .net To Connect To Gsm Modem Via Serialport?
Apr 7, 2011I 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?
VB 2008 On XP Exception With Serialport?
Mar 14, 2009I 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]...
Vendor & Product ID Using SerialPort?
Serial Port Communication Asp Networking
Apr 4, 2012I 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.
VS 2005 SerialPort Control
Aug 21, 2009I'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!
VS 2008 SerialPort Hang-up?
Jun 23, 2010I 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]..
VS 2008 Using Serialport On 2 Different Forms?
Aug 25, 2009I'm using one form to make contact with the serial port with the next
Imports System.IO.Ports
Imports Microsoft
Public Class Menu
[Code].....
Working With SerialPort Control?
Nov 9, 2009output.gif?I've just upgraded to Visual Studio 2008 and have been given a project and getting gps string from a radio via the serial port. I used a program called 'SerialWatcher' and it monitors the data coming in from the radio. It works perfectly. When I tell it the port and settings, click Open, I get consistent output. Here is an example of the data that I got:
<NUL><STX>$PKLDS,124043,A,3337.8562,N,08418.8077,W,000.0,146.5,091109,00,101,2190,80,00,*1C<CR><LF><ETX><STX>$PKLDS,124104,A,3357.1421,N,08403.0604,W,000.0,000.0,091109,3.0,W00,101,3003,80,00,*61<CR><LF><ETX><STX>$PKLDS,124128,A,3354.1213,N,08414.3434,W,000.1,274.3,091109,4.9,W00,101,2576,80,00,*64<CR><LF><ETX>
[code].....
The little icon symbol before the dollar sign is actually two symbols which I think are the <stx> and <etx>. I'm including a screenshot to show what they actually look like. From the output my program created all I would need is actually the last line. I can't really check for 'length' because some data received by the radio will be half that length (or more than half). But there should always be a start and end (regardless of what is in the middle) I would think.
Aborting A SerialPort Readline Method?
Nov 20, 2009I have a program that is hooked to an external device via rs232. I can send and receive messages to this device just fine using the ReadLine() method of the serial port. This allows me to send a command and wait for a response in a synchronous manner. However, when I start the program I need to check the status of the device. If the device is in a sleep state, off, or on, I send a command and get a response, however, if the machine is unplugged, I get nothing so my program will hang waiting for a response before continuing. I would like to abort the readline after 1 minute and display a message that the external device is not connected or having a problem, etc. and allow the program to load. The command I use to check the device is:
Do Until Mid(balanceStatus, 1,3) = 'S S' 'This is the return command that the status is read
spBlance.Writeline ('S')
balanceStatus = spBalance.Readline 'This will cause the program to hang if the external device is unavailable[code]....
That readline is causing the program to hang. So I need a way to abort if it exceeds a certain time (around 1 minute). I was trying to use the DataReceived Event of the serial port, but I need to wait for a response before continuing and DataReceived fires on its own thread.If there is a way to abort the thread, I was thinking of doing a timer control.
Calling A Serialport Handle From A Loop?
Apr 24, 2009Serial Port Communication Asp Net Login
I am trying to run the function:
Code:
Private Sub port_dataReceived(ByVal sender As Object, ByVal e As System.IO.Ports.SerialDataReceivedEventArgs) Handles port.DataReceived
from inside a while loop of a different function ie.
Code:
While A_switch = 0
System.Threading.Thread.Sleep(100) ' Sleep for .1 second
calabrate_send = calabrate_send - 5
[code]....
the real problem is that the serial call updates the value of A_switch which is need to exit the loop at the correct time?
Communications :: SerialPort Timing Control
Feb 17, 2009Serial Port Communication Asp Net Acces
I am using VB2008 SerialPort to communicate with a device. My problem is, using RTS handshake I am missing the first 50 or 60 chars, after that everything is intact. I tried to change the buffer size - Has no effect, used standard, bigger, smaller and no change.
The device timing says when it sends CTS signal, it will start listening 100ms after that. I have no clue how to delay the write to test this. Should I first write to the buffer then write to the port after a a 100ms timer event?
Controls - MSComm From VB6 And SerialPort From .NET2005?
Jun 4, 2009Serial Port Communication Asp Net Banking
I have a problem with this two controls. I have a software in VB6 which send a command to hardware in ASCII type: 170 - head, 3 - numb. of command, CRC.
[Code]...
Serial Port Communication Software
How To Obtain A Handle For A SerialPort Object
Serial Port Communication Asp Network
Mar 10, 2010Serial Port Communication Program
I have a .dll provided by a vendor and it requires me to pass a handle to the com port the device is represented as in order to access some other functions. Can I get the handle from the SerialPort object? The device I'm working with is a USB-UART converter chip with auxiliary I/O. I need to access the I/O which involves using a Visual C++ 6.0 .dll which is the one that requires the handle to the Com port.