Rs232 Serial Programming - Port To C# - .net Code Works Correctly - C# NOT?

Nov 5, 2009

The vb.net code is functioning correctly as it talks to a device through COM1 serial port.What I was hoping was the equivalent c# code is not creating the same string and as a result, the serial 'packet' is not correct. Check this illustration of my problem [URL]...

My goal is to eliminate the addition of the extra characters '/0' and '/b' that what I hoped was the c# equivalent to the correctly functioning vb.net code. It just occurred to me I should change the code to employ Stringbuilder. The 'packetbuilder' method/function builds a string and keeps concatenating things to itself.

[Code]...

View 5 Replies


ADVERTISEMENT

IDE :: Serial Port Communation Using Usb To Rs232. In Collage

Mar 18, 2011

i have some code here that is used for a project, the code is used in visual basic 6 and i am using visual studio 2008 in the project i have to communicate with a PIC micro controller, i do not know what to do because in visual basic 6 w use MS comms and in visual studio 2008 uses a serial port thing code below.[code]

View 3 Replies

Read All Data From Serial Port (Com1 / RS232)

Nov 2, 2009

I am trying to make a program in vb 2005 to real all the data from a device connected on Serial Port (Com 1).i did this: [code]and this is how i want to reciveit.when i lounch the program i only receive first line "410001+00000001" and after that i get on the device rs232 error.

View 6 Replies

Serial Port Example Code - Connect To A Modem Thru The Serial Port

Oct 26, 2011

The link below has code to connect to a modem thru the serial port but it is for an earlier version of VB. when I convert the code, it does not fully convert and has 4 errors that prevent building the project. can someone tell me what needs to be changed or added?

[URL]

Note: the error: not CLS-Compliant

View 8 Replies

Cannot Correctly Read Bytes From Serial Port Consistently

Jun 4, 2009

I have a timer control that sends data to a hardware every 3 seconds. I sent 6 bytes of data. In return I am expecting 8 bytes of data in DataReceived event. First time I send 6 bytes of date, in DataReceived event, I get the expected 8 bytes. Then in next 3 seconds, again the expected 8 bytes of data is received. But after that I find that DataReceived is fired 2 times: first time I get 6 bytes and then I get 2 bytes. After that I again get 8 bytes as expected. So in short, 2 times I get 8 bytes as expected and 6 bytes and 2 bytes and again 8 bytes. This pattern is repeating continuously. Why? Is there any reason why I cannot get all 8 bytes everytime? Note that the code is in vb.net 2008

Code in button btn_Start ()
'Set serial port parameters
x.PortName = "COM1"

[Code].....

View 1 Replies

Serial Port Programming (voltage)

Apr 6, 2011

I have been trying to come up with a code to send voltage signals to a serial port using Visual Studio 2010, I found many codes online but since i am not familiar with visual basic, I do not understand any of them.

View 8 Replies

VB In A Laptop Through USB Port And A USB-RS232 Converter To Communicate With A Microprocessor Using RS232 Protocol

Oct 18, 2010

I have developed a microprocessor based devise. It can communicate with laptop through RS232 as a VB application. Now most of laptops have USB port only. So I want to use USB replacing RS232 port on laptop side but not change anything on the device side. Can I do this using a USB-RS232 converter? How to change the VB software?

View 1 Replies

VS 2008 - Getting Signal From PIC16F877A To VB 2008 Through Rs232 Serial Port

Mar 5, 2010

What i need to write is i get different signal from PIC16F877A and through serial port, i need to display diffrent text from different signal, Such as: Signal from portB.1 display 1, signal from portb.2 display 2. Between the microcontroller and serial port im using MAX232.

View 2 Replies

.net - Can't This Code Open A Serial Port?

Sep 1, 2010

Public Class my_class Dim WithEvents COMPort As New System.IO.Ports.SerialPort

Public Sub FindReader()
Dim ports As String() = IO.Ports.SerialPort.GetPortNames()
Dim port As String
For Each port In ports

[Code3]...

When it runs, it shows a single COM port "COM1". I am assured that the device attached to it is a standard 8,n,1 and uses 9,600 baud. The exception is "Acess to the port 'COM1' is denied".

View 1 Replies

Reading Serial Port Read Data From Serial Port?

Aug 16, 2011

i am a absolute beginner and i want to use vb to receive data from micro controller through serial port using rs232 standards, i found this code to receive the data serially, can any one tell me where should i paste this code, so that the data received will be displayed in message box.Private Sub DataReceived(ByVal sender As System.Object, ByVal e As System.IO.Ports.SerialDataReceivedEventArgs) HandlesSerialPort1.DataReceived

[Code]...

View 9 Replies

Code To Attach 2 Buttons On Serial Port

Jun 30, 2009

I need code to read a serial port state in which I have 2 buttons attached to some configuration on pins 1-9. The program will then, when one of the buttons are pushed, right arrow or left arrow as a keyboard command.

View 2 Replies

Hooking The Comm Port (RS232)?

Nov 2, 2011

I currently have software that sends out plain text(i.e. 'X') to comm 1 port and was wondering if there was any way to capture that plain text and also respond to that port on the same compute as the port without having anything plugged into the machine (i.e. 9 pin serial cable). I am trying to avoid buy any more hardware as this is an objective to acutally cut down on hardware.

View 1 Replies

VS 2005 How To Read From RS232 Port

May 2, 2011

I have been using VB 6.0 and new to VB.net (VB 2005) I want to know how to read characters from RS-232 port.

I have created serialport object and want to read this sort of thing "A,2451.3955,06715.8253"

View 8 Replies

Read / Write Data From RS232 Port?

Aug 23, 2010

I need to write and read data from a RS232 port. On the RS232 port there is a RFID Card reader-Writer connected. So I need to send hex codes to the device, and have to poll every 1sec if there is a card in the system. If there is a card I need to read the info that is on the card. My biggest problem is I think is that I am not sure how many characters there will be in return after the read command (maybe it is always the same length this I am not sure). What is the right way to read-write to the com port. So I always got the same result and not skipping a code.

View 12 Replies

Read Incoming Data From RS232 Port?

Sep 28, 2011

I want to create an application in VB.net that will read data outputted by a RFID reader on serial port.I want to know how will my application be able to identify the interrupt generated by Serial port and will read data from there?

View 2 Replies

Unable To Close Serial Port After USB / Serial Converter Disconnected

Mar 28, 2006

I have a stand alone VB.Net 2005 application that uses a serial port that generally stays open while the application runs on a Windows XP system. In trying to bullet-proof the UI, I ran into a problem when the USB to Serial Converter normally used to provide the serial port is disconnected while the serial port is open. In trying to handle the resulting error when accessing the port, I find I cannot close the port.

When trying to do so, the error message says something like "unable to close the port. You may not have sufficient permissions." Reconnecting the USB/Serial Converter does not reactivate the port.

[Code]...

View 8 Replies

Read The Data From Barcode Weight Scales By Serial Port And TcpIp Port?

Nov 27, 2010

I'm mohammed from Oman ,I'm visual studio.net programmer How I can Read the Data From Barcode Weight scales By Serial port and TcpIp port

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

Convert A Byte From The Rs232 Port To Unsigned Char Or Any Other Variable To Process It?

Mar 24, 2010

how can i, for example add a datum from the rs232 with other variable here is my code:

Dim ii As Byte
Dim c(100) As Char
c = Me.SerialPort1.ReadExisting()

[Code]....

View 19 Replies

The Given Port Name Does Not Start With COM/com Or Does Not Resolve To A Valid Serial Port?

Aug 2, 2011

If I uninstall the COM1 and reboot, it works. If I shut down (power off) and restart, I get the message below. If I uninstall then click on Scan for Hardware Changes,The given port name does not start with COM/com or does not resolve to a valid serial port. Parameter name:portName

View 8 Replies

VS 2008 Writing Some VB2008 Code To Control Four 7-seg LED's / Serial Port Control?

Nov 10, 2010

I'm writing some VB2008 code to control four 7-seg LEDs I bought from Velleman. They came with some example code in VB 5.0, and with instructions telling me to input 5 bytes at a time in the format Chr$() & Chr$() & etc. for the rest of the 5 bytes. When I try to do this using VB2008, it rejects the $ sign, so I've tried it using the Chr() format, which VB2008 allows. However, it doesn't work. Is Chr() the new version of Chr$() or are they different entities? In sending data to the LEDs, I'm using LiveComPort.WriteLine() as my command. (My serial port is called LiveComPort) I also tried it with LiveComPort.Write() asthe command. I know that my serial port and the LEDs are working, because they respond to the demo program provided by Velleman.

View 7 Replies

Communications :: Serial Port - Run Program, "Access To The Port 'COM1' Is Denied"?

Oct 15, 2008

Im having problem with the Serial Port. When i run my program, "Access to the port 'COM1' is denied". What does that mean? Im not sure whats happening because theres no error in my code. Someone suggest me to use 'COM2'. Which is also the same result. I have a microcontroller, programmed and run it. And i need to capture the data onto my vb, which is on a multiline textbox. How to i do that?Just to double check my code?

[code]...

View 1 Replies

Game Programming :: Make For Loop Stop Once Username And Password Have Been Found Correctly

Feb 24, 2011

I have a login in system that i'm creating for a game. I have this code for checking to see if the username and password are correct in the text file.[code]I want to know how to make the for loop stop once the username and password have been found correctly.Also, where would I put a message box saying that the username or password are not correct if they don't match up or they're not in there at all?

View 3 Replies

Programming USB To Parallel Port Converter?

Jul 4, 2010

I am new to VB and am needing to write to the parallel port. I am using a laptop so have got a USB to parallel port converter and need to know how to write to it using VB (I am using Visual Basic Express 2010)

View 7 Replies

Serial Port Use In A DLL?

Jun 3, 2012

I am trying to buld a DLL in VB.NET 2010 that will be use to control a vending machine.Whin a call into the DLL to a function to open and setup the comport the first time its opens it just fine, but if a call into the DLL again it does not know that the port is open even if it is still open. I can check with another program and is shows the port is open and if I try to call into the DLL again to open the port I get an error that the port is already open. Any idea how to set this up so it will work

View 7 Replies

Code For Checking The Serial Serial Number Of A Usb Stick?

Nov 21, 2011

With this code i check the serial serialnumber of a usb stick.

[code]...

It is not perfect because the programma crash when there is no usb in de PC.But how do i search fot the sctick if it has a name , for example PPH ? And not G: , because it is everytime a different station.

View 5 Replies

.net - Serial Port Communication?

Dec 30, 2009

i'm creating a windows form to send/receive data to/from serial port.At first : i send the data as string to the serial port .Second: i tried to read the string again for test the successfull transmission , but i recieved empty string

[Code]...

View 4 Replies

Accessing The Serial Port?

Oct 21, 2011

I can find documentation (preferably with code samples) that will guide me through all the steps to activate and read from a serial port?

View 6 Replies

BreakState Serial Port In CE6.0?

Oct 31, 2010

For my application a need to set a breakstate on/off of 25ms.In Xp this runs fine when I set breakstate=true and wait for 25ms and then breakstate= false and wait 25ms.In CE6.0 when I set breakstate = true, it only throws a puls.It is even not possible to keep breakstate on.

how to solve this or is there an alternative to simulate a breakstate?

View 3 Replies

Communicate To Serial Port?

Jan 15, 2011

can we communicate to Serial port COM1 through Microsoft Robotic Studio?We are developing wireless robot which will take data from serial por

View 14 Replies







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