Re: simple serial string display help
- From: "benkokes@xxxxxxxxxxx" <benkokes@xxxxxxxxx>
- Date: 7 Oct 2006 14:47:12 -0700
It sounds ( from your urging) that invalidating the display is the way
to go. Could you perhaps point me in the direction of how to do that?
I figured that my I/O thread would just constantly update an averaged
array ( averaged over the last few readings) , and then when the
display invalidation comes along, it just takes the averaged value. I
figured if I do that, then I will have to worry less about spiking
values.
thanks!
Paul G. Tobey [eMVP] wrote:
Ok, I had the serial string stuff already from various examples I had
found across the net. So I am glad to see you have the same stuff here,
it reasures me that I am on the right track.
The CreateThread() is for creating the thread to check the serial port
I assume, yes?
Yes, your UI loop won't be running to receive that serial data, so it makes
no sense to read it there.
I figure that I could induce a screen re-draw if the
WaitCommEvent thread for receiving data was running simultaneously with
the WinMain thread . ( I am assuming that this wait event acts like an
interrupt and jumps to a portion of pre-defined code once the interupt
condition is met).
If thats the case, why couldn't I just put in all the screen redraw
stuff under the "subroutiene" of getting the serial data?
Since you're going to have to have a thread to call WaitCommEvent(), anyway
(you can't put that in the UI thread!), you might as well just do the I/O
there, too. You're going to have major flicker on the display updating with
every character, as it is. You're not going to like the result, I can
almost guarantee, but, if it's just a test program to make sure that serial
I/O is working, then I guess you may be able to live with it.
Let me add that this is going to go onto a Pencentra handheld tablet
and is ultimately going to end up in my old Bronco. I hopefully will
get it to communicate with an Atmel microcontroller and get the ADC
data from it(the Atmel). There are 8 ADC's each having 8bit usable
resolution, for vaious sensors that are on the vehicle such as
temperature, pressure, oxygen(in the exhaust), etc.... Basically I want
to display the 8 sensors, their digitized values on the Handheld, and I
would like to do it as the data comes in. Later in life, I want to use
one of the parallel ports on the Atmel to Bitbang a GPS signal into the
serial stream going to the handheld, but that is a much later project.
Anyhow, I hope this helps you understand where I am going with all
these crazy questions...
What you'll want to do is use a separate thread to get the data and
interpret it. Once a second or thereabouts, you can invalidate the display
and update your gauges, dials, etc. You're going to have to do some kind of
double-buffering, though, with the display, I think, to avoid flickering
like crazy.
Paul T.
.
- Follow-Ups:
- Re: simple serial string display help
- From: Paul G. Tobey [eMVP]
- Re: simple serial string display help
- References:
- simple serial string display help
- From: benkokes@xxxxxxxxxxx
- Re: simple serial string display help
- From: Paul G. Tobey [eMVP]
- Re: simple serial string display help
- From: benkokes@xxxxxxxxxxx
- Re: simple serial string display help
- From: Paul G. Tobey [eMVP]
- Re: simple serial string display help
- From: benkokes@xxxxxxxxxxx
- Re: simple serial string display help
- From: Paul G. Tobey [eMVP]
- simple serial string display help
- Prev by Date: Formatting SD cards
- Next by Date: Re: Go to Low Power until I receive Data from a COM port
- Previous by thread: Re: simple serial string display help
- Next by thread: Re: simple serial string display help
- Index(es):
Relevant Pages
|