low sampling rate with adc

Status
Not open for further replies.

tux21

Junior Member level 3
Joined
Apr 9, 2008
Messages
25
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,468
i have to get around upto 900 Hz signal in MATLAB for which i use adc0808 with 8051 AT89S52

i use uC pin to generate clock of about 230kHz for adc. when i use 4 D flipflops to divide 11.0592MHz clock of uC by 16 and give it to adc it doesn't work(given like this in Mazidi book)

Now, i am able to get enough sampling rate for sine waves upto 50Hz but above that i get distorted conversion most likely due to undersampling as in figure attached . I have configured the uC to continuously operate the adc and send values to pc via serial port.

baud rate is set at highest possible 57600. matlab collects these binary values and stores in its serial port inputbuffer (1 MB) from where i read them to plot.

My problem is i am not able to get sufficent sampling rate for signals above 50Hz when i test with a sine wave generator.

The sampling rate is not controlled by me.
Plz help. I attach the assembly code with comments as well
 

The max sampling rate for adc0808 is 10kHz
 

yes
but why am i not able to get proper display of digital waveform in matlab?

is it a matlab problem?
 

I don't think you have a problem with matlab but rather with your acquisition system.
Moreover, if your sampling clock is 230kHz, the Nyquist theorem tells you that you can sample a signal up to 115kHz. So you should not have any problem with that (provided that your adc can actually work at that frequency - and this is NOT your case...).
 

230 k is adc clock and not sampling rate. sampling time period must be more than 100uS as in datasheet.
 

Can this adc deal with audio signals.Can anyone test it?
plz tell me i have to complete urgently
 

i cheched with matlab, the usb to serial conv. i use is giving correct baud rate of 57600 when i transmit simply ascii value '2' from uC to pc
 

i think i could finally get something. i connected the ALE pin i.e 30th pin of 8051 as clock to adc0808. Its suppose to give 1/6th of 11.0592MHz ie.like 1.8432 Mhz. But adc max clock is specified as 1.28Mhz :-?. Also i have connected pin 31 to Vcc.

First i tested pain single character sending to matlab from uc and found to time it took to fill a large InputBufferSize and concluded that it was more than 5000 samples which is close to the theoretical 57600/10=5760. So my usb-> serial was okay.

Then i minimized all the delays in the adc operations. used timer instead of loop delays. It turns out adc0808 is not that slow. It will do adc faster than the uart can send samples to pc. No special delays were required between setting ALE,SC,OE,ADDRESS etc. But the high clock was a must. I have also not used any timer and serial interrupts. Just get adc value in accumilator, put in SBUF and monitor TI flag.
This method gives me around 4500 samples/sec. the 4 q flip flop method in mazidi will not work as the input from crystal is insufficient to drive the Flipflops.

Also keep sufficent InputBufferSize in matlab serial around 50MB. This is not good for audio signals, but for ECG,EEG,EMG etc it will do.
Attached picture of 800 Hz sine. Multiply the circles in a period with
time period 2ms to get sampling rate.

i'll come with if more trouble comes.
ps. also adding 800Hz sine , spline interpolated to triple sampling rate in matlab
 

Done!
now i am at 115200 baudrate using 11.0592 crystal and timer2. getting around 7200 samples/sec. i think adc is the limiter this time
 

Great!

now i am able to get out around 11,200 samples/sec from the ADC+uC combination. Earlier i used to do adc then wait for TI to set and clear it i.e wait for frame to be transmitted.

JNB TI,$ ;WAIT FOR SERIAL TRANSMISSION
CLR TI

But now i can omit the above wait for Tx to happen and directly go to obtaining the next adc value to be Tx
The trick i found is to initialize serial Transmission in the beginning itself just once with

MOV SBUF,#'0' ;INITIALIZE Tx

before starting anything else. Once this is done adc and uart transmissions can be done without any delays between them ;->

Note that i am using 1.8Mhz as my clock for adc0808 from ALE pin

Added after 3 hours 13 minutes:

well that trick doesn't work
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…