CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Storing accelerometer adc values to external RAM

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
kein



Joined: 23 Jul 2007
Posts: 103

View user's profile Send private message

Storing accelerometer adc values to external RAM
PostPosted: Thu Mar 27, 2008 2:37 am     Reply with quote

My project involves creating A running average filter to smooth or remove the noise and then continuously recording/storing accelerometer adc (values) readings from adxl320 for 3 minutes into an external RAM and then reading back the stored values from the RAM for analysis.

The analysis would involve finding the first 3 consecutive maximum peaks from the stored adc values and their indexs.

Some people have fed the output from adxl320 through a full wave rectifier in some cases and I don't why that was done! any help!

can any one help on the best external RAM the will do this job and on how I can be able to read back the recorded data from the RAM.
Can anyone also help/suggest if using software filtering is a good idea here. here is a simple filter.
int nSamples = 512;//would be samples read from external RAM

Code:
 const int taps =32;                                                                             
 const int16 a[taps+1] = {                                                       
                     0x0000, 0x0003, 0x000C, 0x001D, 0x0039, 0x0061,
                     0x0096, 0x00DB, 0x012E, 0x018E, 0x01F4, 0x025D,
                     0x02C0, 0x0317, 0x035B, 0x0387, 0x0396, 0x0387,
                     0x035B, 0x0317, 0x02C0, 0x025D, 0x01F4, 0x018E,
                     0x012E, 0x00DB, 0x0096, 0x0061, 0x0039, 0x001D,
                     0x000C, 0x0003, 0x0000};
void BPfilter(float ip[])
{

        int nSamples = 512;//would be samples read from external RAM
        float x[taps];
        //float op [nSamples];
        float y;
        float s[taps];

        switch (filterType)
        {
            int16 s[taps+1];
            case LP:
            case BP:
                // 34th order Kaiser BP filter
                // 1 kHz centre frequency, 8k samples/s               
                for(int i=0; i < taps; i++)
                s[i] = a[i];
                break;

            case HP:
               break;
        }

        for (int k=1; k<taps; k++)
            x[k] = 0.0f;

        for (int i=0; i<nSamples; i++)
        {
            x[0] = ip[i];
            y = 0.0f;
            for (int k=0; k<taps; k++)
                y += s[k]*x[k];
            op[i] = y;
            for(int k=taps-1; k>0; k--)
                x[k] = x[k-1];
        }

        //return op;
    }

My sampling frequency is 1000hz and the frequency of interest is 4hz.My PIC processor is pic18f4450.

Kind regards,
Kein

Shocked
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Thu Mar 27, 2008 11:23 am     Reply with quote

You could use FRAM from Ramtron. This is similar to eeprom except that
it has a very short write delay time -- a few nano-seconds, compared to
the typical 5ms for an eeprom. This means your overall memory cycle
time (R/W) is very low.

They have i2c or SPI versions. I've used the i2c version at about 700
KHz clock rate. If you really want to ramp up the speed, the SPI version
would be better.
http://www.ramtron.com/doc/Products/Nonvolatile/Nonvolatile.asp?ID=5
kein



Joined: 23 Jul 2007
Posts: 103

View user's profile Send private message

FRAM unavailable locally
PostPosted: Mon Mar 31, 2008 4:09 am     Reply with quote

Thanks PCM programmer. I appreciate your contribution very much. Besides it seems I cannot find the FRAM locally and while I'll try to get it ordered, is there an alternative chip that you could recommend for testing purposes?

Remember I'll be recording the adc values from accelerometer into the RAM for 3 minutes. That requires alot of RAM.
Kind regards,
S.Kein
kein



Joined: 23 Jul 2007
Posts: 103

View user's profile Send private message

Wireless application
PostPosted: Wed Apr 02, 2008 5:11 am     Reply with quote

Guys any good small wireless transmitter that you can recommend. I would like to interface pic18f4450 to a wireless transmitter to send the accelerometer adc values to a pic16f877A receiver connected to a PC so that the PC could take care of the tedious mathematical operation of data analysis that a micro controller can't do. That include filtering, smoothing, damping ratio calculation and furrier analysis automatically.

Instead of PIC digitally filtering, calculating the damping ratio and the natural frequency from the accelerometer data, I could just send that data wirelessely to the pc and let the pc do the job. I'll design a window application that will be receiving and saving the data and then analyze the data in vb.net. The receiver could be in the range of 500m. And since the accelerometer device will be mounted on the vehicle chassis then the antenna ought to be really small.

Any for a good PIC to wireless transceivers interface for a start?

Please help.
Kind regards,
S.Kein
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group