i've connected my Nokia 7610 through the usb to my PC to use it as a modem i tried to connect to it through the hyper terminal and succeded,but when i try to open the com port using serial port class it does nothing or maybe open it then close it any idea y is that
I have a similar issue, trying to open a connection to a bluetooth serial comms adaptor.
The bluetooth connection works fine with hyperterminal, the serial adaptor sits on a virtual com port "COM51".
When trying to use the serialport class to access this, it refuses to open the port.
I'm inclined to think that the issue is with the port address as I am reading the available ports and placing them into a string and then dropping them into a combobox.
But in the list all the real com ports look ok but the virtual ones seem to have the wrong names i.e. the port the bluetooth connection sets up is COM51 but in the combobox it appears as "COM51i" rather than "COM51", does anyone have any idea why that may be ?
I have a weather station made by myself and I have to send the data to the PC. In VB6 its very easy to detect the bytes received with the commEvent,is there something similar in VC#.? How does it work?.
I'm new to C#, but I have had some previous OOP experience. I'm trying to use rebuild this program, but I've encountered the following error: 'SerialPort' is a 'namespace' but is used like a 'type'. I checked previous threads and I saw that if you install the .Net 2.0 framework this problem should solve itself, but I've installed 2.0 and 3.0 and I'm still having this problem. Could somebody help me out?
Also, I'm curious how you got the same "Form 1" to show different things depending on what stage of the app you were at. It can't just be all hiding can it? Thanks for your help.
Never mind...I got it to work. My form 1 still looks like a mess because there are 4 labels, 4 buttons and a thin text box stretched across the form. Could you let me know how you got everything onto one form?
I've a problem in my application in sending ctrl+z over serial port, i'm conected to a modem, and i'm doing all functions through hyper terminal, also using serial port compnent in VS 2005 except this part, it's to break code, i tried to send it as i got it's ascii character which is 26, but it couldn't do the acction that i want.
i tried this one (and others) but no success
please contact me urgently on my e-mail email@example.com
i am doing a project on railway signalling in vb.net.
my requirement is i have to control or adjust the form designed in my computer from another computer connected through a serial port cable.
to be in detail i have designed a track circuit with some picture boxes and buttons.so i need to change the color of the picture boxes and buttons through xl sheet in another computer by changing the status from 1 to 0 and viceversa.
first i tested for the communication between two systems by writing a chatting application which is working fine but i am not getting the idea to do the main task
I am trying to get text from an Emergency Alert Box, but the SerialPort1.Bytes to Read shows 0 until I connect a loop back to the serial port and write a line "This is a test", then it shows 313 and properly reads the text string from my EAS box.
serialPort1.PortName = txtComPort.Text;
serialPort1.BaudRate = int.Parse( txtBaudRate.Text);
serialPort1.DataBits = int.Parse(txtDataBits.Text);
//COM10 opens fine at 1200,8,n,1
serialPort1.WriteLine("This is a test");
The application I am writing is for a mobile device, this device connects to a total station (instrument used for land surveying).
The mobile device and the total station connects via a comm port, how can I read data from the total station?
I'm programing a Pocket application chat, in C#,for serial communication with PC.
I have problems with those methods ReadLine(),WriteLine(), Read() and Write().This troubles happen when I use frequently this methods, hour function correctly hour don't function.For example:
/* This app in the Pocket.
label1.Text = "The device don't answered.";
*/ I configured the readtimeout for 10 seconds, but if I wait many time(above 3 seconds) for send bytes from my PC for the Pocket, this method ReadLine don't gets the bytes from serial port.
When I use the same part of code for write in the serial port changed sp.ReadLine for sp.WriteLine()and send a sequential characters('dddddd'), this method hour send hour don't send for PC or send only one character.
The same thing happen with methods Write and Read(char buffer,offset,int lenghtarray).
I think that there is problem with readtimeout,writetimeout and buffers in the Pocket.
I connected the wires correctly in the serial port the PC and Pocket, I configured both for bauderate of 300 and stopbits too.
Plis, help me!
Leonardo - Student of electrical engineering of Federal University of Bahia-Brazil
I have a problem with the ReceivedBytesThreshold property of the SerialPort class.
I have a device (builded by myself) connected to COM1, and I’m trying to read a flow of data from such device one byte every time (I mean byte by byte), using a null modem connection, so I configure the port with the following:
Notice that I set ReceiveBytesThreshold to 1, so I would expect that the event handler mPuertoSerial_DataReceived is launched when a byte is received. This is true if my device sends the bytes slowly, that is, if it sends a byte, then waits some few milliseconds, then sends the next byte, waits again few milliseconds, and so on; but if it sends the bytes one just after the other, without any dead times between consecutive bytes, the event is launched every 8 bytes, and not every 1 byte. And there are some curious things:
- the eight bytes are correctly readed, so I’m not loosing them, I just can’t get the event launched every byte.
- If I set ReceiveBytesThreshold to any number between 1 and 8, the event is always launched every 8 bytes; if I set ReceiveBytesThreshold to any number between 9 and 16, the event is launched every 16 bytes; if I set ReceiveBytesThreshold to any number between 17 and 24, the event is launched every 24 bytes, and so on…
- If I set ReceiveBytesThreshold to any number between 1 and 8, and my device sends only 5 bytes (e.g), the event is launched at the receive of the fifth byte. The same happens for 16, 24, 32 and so on…
the RecBytesThr is just used to determine hiow often events are sent when bytes are received, sometimes though the bytes come faster than you can read them in the event handler.
ive had this problem (i know this is a late reply). the serialport has a "bytes to read" property, you must send the bytes to a byte array, and use the bytes to read to determine how many bytes to read from the array in a for-loop or whatever.
Thanks for your reply, and belive me, it's not late, actually I haven't solved the problem yet (I made the comunication using other things).
I belive that I understand what you say, but since I'm working with a real time system I can't wait for a group of bytes to reach the buffer and then read them using the "bytes to read" property, I must process every byte as soon as it arrives and that's why I set the ReceiveBytesThreshold property to "1" and (in theory) every time the event handler is called, the "bytes to read" property should be "1", is n't it?
Anyway thanks for your reply, and if you have something else to say that may help me, i would really appreciate.
PD. Please excuse my english