473,503 Members | 1,656 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Serial Port Communication in C# using sPort_DataReceived() event

2 New Member
In an application of:
Serial Port Communication in C# using sPort_DataReceived() event

I have noticed that the maximum number of characters that you can receive using this event is limited to 8, and if you try to receive a string having more number of characters, it receives the first 8 characters in the first Timer tick, and than receives the rest in the second timer tick.

İs it possible to receive the complete string at once (say a string of 16 or 20 characters) and whta are the actions to take for this
Sep 14 '07 #1
2 2717
Plater
7,872 Recognized Expert Expert
8 bytes sounds like a pretty standard (albeit small) hardware buffer for a UART.
(I work on systems with a 4byte buffer)

A key tip about the SerialPort class I have found:
Do as little as possible in the EventHandlers, you'll thank me for it later when you're not dropping bytes.

I had it setup so that the dataReceived() event only set a boolean that told a Timer.Tick() event to read data and push it into a software buffer (An arraylist maybe or some other dynamic allocation object)
Then I was no longer dropping bytes and they were all there ready for me.
Sep 14 '07 #2
suhabayindir
2 New Member
8 bytes sounds like a pretty standard (albeit small) hardware buffer for a UART.
(I work on systems with a 4byte buffer)

A key tip about the SerialPort class I have found:
Do as little as possible in the EventHandlers, you'll thank me for it later when you're not dropping bytes.

I had it setup so that the dataReceived() event only set a boolean that told a Timer.Tick() event to read data and push it into a software buffer (An arraylist maybe or some other dynamic allocation object)
Then I was no longer dropping bytes and they were all there ready for me.
Thanks very much for the useful tip Platter, I shall try and let you know of the outcome
Sep 14 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

6
2831
by: Leandro Berti via DotNetMonster.com | last post by:
Hi All, I wrote a code to do serial communication with an equipament. When i use the code outside of threaded class it seens work properly, but when i put inside a class and execute a thread in...
4
11154
by: joe bloggs | last post by:
I am writing a mobile application to interface with a legacy system and I am planning to use web services to communicate with this system. The legacy system receives data through a serial port. ...
4
11028
by: Lonifasiko | last post by:
Hi, I've been able to communicate using HyperTerminal with my device via serial port COM1. I just send a command and device switches on. I just need that to start playing with it. This way, I...
5
7878
by: Mo | last post by:
Hi, I have an application where I read a serial port data from a barcode and set the labels on a form. I also have a textbox and button where you can enter the data and here is the problem. if I...
0
1972
by: usagimys | last post by:
Hi all, i'm very new in serial port communication.. here i got some problem in writing to the serial port.. i have done the connection successfully.. let me explain my situation.. i'm doing a system...
1
2487
by: laura salhuana | last post by:
Hi: I am trying to write a serial communication GUI application. My application has the following specifications. When I set my board up in hyperterminal I do the following set up: bits per...
2
1912
by: Marco Trapanese | last post by:
Hi, every 250 ms (timer event) I must send several commands via serial port. The serial unit will answer to each command sent. I must wait the answer before send the next command. How can I...
4
4789
by: max_mont | last post by:
Hi all, I'm a newbie in .NET technology. I've already developed Serial communication applications in C++ (WIN32). And I wanted to migrate to .NET technology. There is a serial component in...
6
11677
by: cnixuser | last post by:
Hello, I have a basic application written which is designed to data over a serial cable and then receive a response back. I am not getting any triggers to my data received event. I have tried...
0
7198
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7072
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7271
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7319
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6979
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7449
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
4666
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3149
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
373
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.