9 years ago.

LPC1768 Sampling rate and LabVIEW System

Hello, I want to make a DAQ board using a LPC1768.

In Labview system, I made DAQ program for logging data.

LPC1768's datasheet said 200KHz Maximum sampling rate in 13MHz.

but I couldn't get data High frequency samples.

I used diversity code in ARM Forum. but I can't solve this problem.

Please see this figures. /media/uploads/iNES_lab/10hz.png Fig 1. is 10Hz Sine wave from Function generator. It is good. /media/uploads/iNES_lab/100hz.png Fig 2 is 100Hz Sine wave, I get good data. /media/uploads/iNES_lab/1khz.png Fig 3 is 1KHz Sine wave, but it was distorted! you can see this picture, samples of a period is 7-8 points. when Nyquist's theory, general signal sampling ratex2, but sine wave need almost x10.

Why LPC1768 can't make sample 200KHz?

I used library FastAnalogIn : http://developer.mbed.org/users/Sissors/code/FastAnalogIn/ ADC_Test : http://developer.mbed.org/users/simonb/code/ADC_test/ ADC_fast_sample_and_send : http://developer.mbed.org/users/gno/code/ADC_fast_sample_and_send/

But I can't get accuracy data and fast samples..... This result that I set baud rate 921600 or 460800. but i don't think main problem is not baud rate. How can i change this source?

I just want to the fastest ADC single channel, don't need signal filter(because labview will filter),

Here is my code.

  1. include <FastAnalogIn.h>
  2. include <mbed.h>

AnalogIn ain0(p20);

Serial pc(USBTX,USBRX); Tx, Rx Pin

int main()

{

pc.baud(460800);

while(1)

{

pc.printf("%f\n",ain0.read()*3.3);

}

}

/media/uploads/iNES_lab/labview_code.png

Last Fig is my labview(2014) code.

I hope to get some tip.

Jeongdae (iNES)

1 Answer

9 years ago.

You might try buffering some samples before sending them to the pc:

#include <FastAnalogIn.h>
#include <mbed.h>

AnalogIn ain0(p20);

Serial pc(USBTX,USBRX); 


// define the maximum number of samples
#define BUFFERSIZE 256

int main()
{
        pc.baud(460800);
        float buffer[BUFFERSIZE];
        int t=0;

        while(1)
        {
                // get samples in buffer
                
                for (t=0; t<BUFFERSIZE; t++)
                {
                         buffer[t]=ain0.read();
                }

                // now send them to the PC
        
                for (t=0; t<BUFFERSIZE; t++)
                {
                        pc.printf("%f\n",buffer[t]*3.3);
                }
        }
}

I really thanks for you!!

posted by iNES lab 28 Apr 2015