??? 02/04/11 05:56 Read: times |
#180992 - How fast are you sampling Responding to: ???'s previous message |
Just how fast are you sampling the waveform?
I think there may have been some misinterpretation in some of the replies here when you mentioned the 3Hz number. Some folks may have thought that you were sampling at a 3Hz rate rather than sampling a signal that has a frequency of 3Hz. The straight lines you see in the graph may simply be the graphing software connecting two points by a straight line when there was no sample data for other points in between. It sounds to me like you have made your code in a manner that does not facilitate a fast sample rate. If you have made your code such that you poll an A/D converter reading to completion and then turn around and send the data out the UART in a polled manner you may be making the program waste a lot of time in wait loops. One sure way to improve your sample time in this scenario is to use a timer interrupt to launch the A/D conversions. This same interrupt could first read the result of the previous conversion, queue the data to the serial port and then finally trigger the next conversion to start. The serial port handler should then also be setup with a circular queue that gets loaded from the input side in the above mentioned timer interrupt and unloaded on its output side via the serial port interrupt handler. Michael Karas |