473,699 Members | 2,838 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

C#-APP: FIFO serial output - how to limit lines?

2 New Member
I'm working on a project currently that needs to have a fast FIFO text box that displays output from a serial device. It also needs to have fast refresh rate as the data can stream in at about 50 samples a second.

I'm a new C#/managed/.NET developer, so pardon me if I don't understand some principals. A friend recommended I look into a queue, but the overhead involved in queuing up the incoming lines, converting them to an array, then displaying them as a string - 10 times a second, was just plain outrageous. Is there a way to feed a ueue right into a textbox? Otherwise, what suggestions do you have?

(My preferred limit is 1000 lines for now, but I'd like to dynamically adjust that at runtime later.)


~Polatrite~

P.S. Can anyone point me to an extremely up-to-date resource for double-buffering? This flickering is killing me, and I've tried 5 different double-buffering tutorials and it's still flickering the same, or worse.
May 26 '07 #1
3 2496
oohay251
27 New Member
Who is going to read the strings at 50 samples per second?
Would it be satisfactory to program it to just show the most recent string received/queued?
I've not had a reason to mess with serial ports before, but have you looked into the System.IO.Ports .SerialPort class? It provides synchronous and event-driven access to the pin signals and easy access to a Stream object to read and write from/to the port.

To test performance, you can tie the class to an event which updates the text in the text box.
May 26 '07 #2
Polatrite
2 New Member
Who is going to read the strings at 50 samples per second?
Would it be satisfactory to program it to just show the most recent string received/queued?
I've not had a reason to mess with serial ports before, but have you looked into the System.IO.Ports .SerialPort class? It provides synchronous and event-driven access to the pin signals and easy access to a Stream object to read and write from/to the port.

To test performance, you can tie the class to an event which updates the text in the text box.
It's not a matter of who's going to read 50 samples a second. The textbox needs to be displaying in realtime the raw data received from my wireless serial device. It will also be logging the data.

As far as the SerialPort class, I've definitely used it - that's how we pull the data off the serial device. But I'm talking about getting in into a textbox that displays effeciently with a good scrollback. If you're familiar with some of the more featured telnet/SSH clients (putty), that's the type of speed I need.
Jun 13 '07 #3
Plater
7,872 Recognized Expert Expert
I've never had trouble getting a textbox to update quickly.
If you use the .AppendText() function it will autoscroll as well.
If you're really picky, write like a wrapper function:

Expand|Select|Wrap|Line Numbers
  1. private void TBTheMsg(string msg)
  2. {
  3.    mytextbox.AppendText(msg);
  4.    mytextbox.Invalidate();
  5.    mytextbox.Update();
  6. }
  7.  
Or something, I've written terminal-style apps with it just fine.
Jun 13 '07 #4

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

Similar topics

2
3712
by: Peter Albertsson | last post by:
Hi, I'm using fpassthru() to send files to the browser, but only the first 2000000 bytes are sent. The apache log shows 2000000 bytes too. Where does this limit come from and how do I change it? My system: PHP5.04
2
1871
by: Samantha | last post by:
Is there a limit on the size of the file Python will read then output. I am reading a file of 433 lines and when I output the same file it only will output 421 lines. The last line is cut off also. This is the code I am using as a test. input = open(r'C:\Documents and Settings\Owner\Desktop\somefile.html','r') L = input.readlines() input.close output = open(r'C:\Documents and
2
6779
by: Andrew Rich | last post by:
Howdy, I have a need to do this :- 1. find a match 2. go back three lines 3. read out lines 1 2 3 eg
5
23356
by: Jay Chan | last post by:
I am trying to use a command line program to run a stored procedure that generates output in a comma-delimitted format. Somehow, ISQL or OSQL always wrap the lines at 256 characters. I believe this has something to do with the column width switch (-w). But enlarging the column width to 800 characters max still doesn't help. The following is a stored procedure that is essentially doing what my stored procedure is doing: create procedure...
4
5741
by: gualtmacchi | last post by:
I'm processing an XML input file getting a plain text file where from M nodes I got N output lines... It's not relevant but the input file is a recordset coming from a database and the output is an EDI message set. Now I need to put into the output file also some information regarding just the output file itself and not the input one. And it cannot be expressed in terms of input information. For example I need to determine and write how...
1
1533
by: jayanthiveerabahu | last post by:
Hi, I am running a C program that parses an XML file and displays the parsed output. The compiler I use to run the program is BORLAND C (Version 3.1). My problrm is " the output window displays only 25 lines of the parsed output". Remaining lines are missing.When I run the same program in turbo C I am able to see the entire parsed output. Why not with borland C? Please give your valid inputs as soon as possible.
9
2629
by: cniharral | last post by:
Hi, I'm interested in printing out coloured lines of my application and I don't know what to use. Can anybody give me an idea?? Regards. Carlos Niharra López
15
1814
by: jools | last post by:
I'm having trouble modifying some code written by someone else. The code is very dense and obscure but does work fine. However I need to insert a block of my own and I've hit what I assume is a buffering problem.(If there's another answer I'd be grateful ...) The problem is PHP is refusing to do things in the correct sequence. I've tried all the variations of flushing I can think of without success. Can anyone suggest how I can force...
5
1412
by: Techninjaz | last post by:
We've been having this issue where System.out.println() will totally ignore a line that contains '<' or '>'. Is there some sort of escape character that we need to output these lines?
0
9171
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9032
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8905
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8880
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7743
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6532
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4373
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
2342
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2008
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.