Well, since my sender part, and the protocol is complete, i'm starting to design my oscilloscope receiver, renderer, basically, where all the action and smart computing will take place.
I made a simple sample in Visual Basic 6, but such a processing task is far beyond what it can do (or my approach is bad)
Basically, I need something like this (this time, I'll have to develop it in C++). Data is received continously on the serial port, at 115200 (highest speed for a default com port, not sure if the number is right). This data is decoded (it contains two values per 'frame') and split into frames. Each 'frame' goes somewhere in a buffer.
Now, that's not really hard.
The hard part is - all this data has to be rendered. The values are simple bytes (0-255). They represent two values read by the device from an Analog-to-Digital converter. So the rendering will represent a waveform or something similar, depending on what is read.
My problem is, what approach should i use in rendering it? I will need an adjustable timebase, so that I can see small differences if I want to (i know there will be loses, and not everything will get to be rendered), but I can also choose a larger timebase, so I can see what happens for a longer time (and some averaging of values might be needed here). When exactly should I start rendering from the buffer?
I was thinking of two approaches - one would be, let the buffer (normal one) fill, then render, then empty. The other one is, write in a circular buffer, and get the rendering use the last X positions (following writing pointer) every Y ms. The problem is here, data may be overwritten while rendering. What do you think? How should this be taken?
There's also another catch which I'm not really able to figure. Oscilloscopes have a useful feature called "trigger and hold". Basically, if I'm seeing a sinewave, at each update, the sinewave will start from a different phase (position, so to say). If the signal is quick, I'll see a ton of gibberish, since a lot of sinewaves will overlap. In this case, the 'scope draws what it sees, and then it waits untill the current value reaches a threshold. When it reaches, it starts drawing it again. So, the wave will always start from the same position, and will look clean Hold is pretty much what is says - it won't trigger until the time has expired. I suppose this will require a different approach to call the 'render' function, but I'm still not sure.
Please let me know how you would do this.
I'm planning to use wxWidgets as a graphical interface, but if you think something else is better, do let me know.
I know to use uc's, but my C/C++ skills aren't good at all. So I might ask for other stuff, too.
When the software and device will be done and in good shape, I'll be happy to send a few to the ones that helped me most if they'll desire so.
izua