??? 03/12/11 07:54 Read: times |
#181555 - Still not mentioned what the problem is Responding to: ???'s previous message |
We still haven't been told what the problem is.
With the sampling rate shown on the posted images, you do not have any bandrate problem using 19200 baud. 200 samples/second times 2 bytes is 400 bytes/second. And at 19200 baud, you can transfer about 2k bytes/second. And your 8051 chip can support higher baudrates - to some part affected by your careful choice of a crystal that divides well with the standard baudrates. You did mention 100Hz in your initial post. You need to sample at > 2*f or more than 200 Hz to be able to figure out frequency, amplitude, phase of a 100Hz signal. But sampling so close to the signal frequency will give huge aliasing problems making it impossible to plot a curve. But with many samples you can compute the signal and then plot a mathematical sine wave based on the computed frequency, phase and amplitude. If you want to capture a curve that can be plotted and look good (and looks good enough to indicate if there are overtones on the curve) then you need to strive for 20*f so maybe 2000 samples/second. A tiny bit lower than 20*f and you would still manage to squeeze your data transfer through the link with 19200 baud. So what is your problem? That the samples does not display well when the signal is 50Hz or 100Hz with your current sampling rate? Either synthetizise a sine wave based on the parameters you can compute from your samples. Or increase the sampling rate. That your link isn't fast enough? Can't happen with the sampling rates you have been displaying. But maybe you are running at higher sampling rates? So step up the baudrate. That you sometimes gets garbage plotted? If you send the data as 2 binary bytes/sample then you will get garbage if the PC program manages to drop a single byte. If the ADC captures <= 14 bits of resolution, then you can set the high bit of one transmitted byte to tell that it is the first byte of the byte pair that forms one sample. If the baudrate is high enough that you always gets a pause between each two-byte pair, then you can use the pause to synchronize. Is it that the PC program uses the time stamp when it receives the data as the time-axis value when plotting? Or is the PC program assuming/knowing that each sample is caught with constant time interval so it steps a fixed length on the time scale for each received sample? You claimed the link was too slow but later claims "the data that is displaye din real time and the data that is displayed after sampling has no difference in them". So exactly what is your problem, because the problems you seem to indicate that you are having does not match the proof you later have been posted. In the end - with your sampling rate and link rate, there should be no problem for the PC to display a curve in real time and to be able to continue to scroll and display until you get a power failure (or M$ gives a BSD). |