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

data storage

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



Joined: 31 Mar 2008
Posts: 29
Location: Mumbai, India

View user's profile Send private message Visit poster's website

data storage
PostPosted: Sun Apr 13, 2008 2:55 pm     Reply with quote

hello,
I have to store the value of the analog channel into the mc memory. anyone can help ? data appears at AN1 with sampling rate of 1 ms. i need to store that value instantaneously.

any basic commands for that?
Matro
Guest







PostPosted: Mon Apr 14, 2008 1:50 am     Reply with quote

Which memory?

The EEPROM or program memory will never be fast enough to allow a write every 1ms.

Matro.
ferrousduke



Joined: 31 Mar 2008
Posts: 29
Location: Mumbai, India

View user's profile Send private message Visit poster's website

PostPosted: Wed Apr 16, 2008 3:50 am     Reply with quote

EEPROM. I guess I have to slow down the process. I dont want it more than 30 ms. how fast can it write into memory ?
Matro
Guest







PostPosted: Wed Apr 16, 2008 4:16 am     Reply with quote

It depends on your chip and the Xtal frequency you are using.

The best is to perform a test :
- generate a rising edge on a spare pin
- run the write_eeprom() command
- generate a falling edge on the same spare pin

You just have to look at the pin with a scope to know how long it takes to write in EEPROM.
Take 1.5x or 2x this time to be sure.

A good thing could be to use asynchronous write. So the chip can continue processing data during the EEPROM writes :
Code:

#device(write_eeprom=ASYNC)


Don't use this directive to test the writing time but only for the real application.

Matro.
Humberto



Joined: 08 Sep 2003
Posts: 1215
Location: Buenos Aires, La Reina del Plata

View user's profile Send private message

PostPosted: Wed Apr 16, 2008 7:24 am     Reply with quote

A FRAM would be your best choise.
A FRAM internally has a structure similar to a DRAM (dynamic RAM), but the storage of
data is made by means of a ferroelectric effect, by opposition to the conservation
of the load in the intrinsic capacitor in a dynamic RAM of floating gate.
Its main features:
- very fast access time.
- virtually limitless writings.
- data retention without energy consumption.

You will search for some application in this forum.

Humberto
SherpaDoug



Joined: 07 Sep 2003
Posts: 1640
Location: Cape Cod Mass USA

View user's profile Send private message

PostPosted: Wed Apr 16, 2008 7:32 am     Reply with quote

Also note that EEPROM has a finite number of write cycles before it fails. The PIC I am using is rated for 1 million write cycles. If you were to write the same location every 1ms you would wear it out in 1000 seconds, about 17 minutes.
_________________
The search for better is endless. Instead simply find very good and get the job done.
Matro
Guest







PostPosted: Wed Apr 16, 2008 7:41 am     Reply with quote

SherpaDoug wrote:
Also note that EEPROM has a finite number of write cycles before it fails. The PIC I am using is rated for 1 million write cycles. If you were to write the same location every 1ms you would wear it out in 1000 seconds, about 17 minutes.

So right a comment.
Even taking the given worst case (30 ms), if each write is at the same location and taking 1,000,000 write cycles as a lifetime, the EEPROM will fail after 8h 20min.

Matro.
ckielstra



Joined: 18 Mar 2004
Posts: 3680
Location: The Netherlands

View user's profile Send private message

PostPosted: Wed Apr 16, 2008 10:59 am     Reply with quote

Quote:
data appears at AN1 with sampling rate of 1 ms. i need to store that value instantaneously.
What do you mean with 'store'? How long do you want to remember the data? In the discussion above everybody assumes you want to remember the data in between power cycles, but is this true? For example, if losing data after a power cycle or reset is no problem than you can store the data in internal RAM which has no speed problems.

How many data samples do you want to store?
How many bits is every sample?
ferrousduke



Joined: 31 Mar 2008
Posts: 29
Location: Mumbai, India

View user's profile Send private message Visit poster's website

PostPosted: Wed Apr 16, 2008 2:54 pm     Reply with quote

I m using 18f4550 with crystal 20 Mhz. I have this position sensor from Renishaw attached to AN1.. (just an assumption) data in this terms would be a single axis coordinate. but I want to store that particular coordinate associating with XY coordinates, so the set of data comprises of 3 coordinates.. (X-Y-Z).. XY will be simply incremented at particular cycles. Z coordinate I need to sample. Moreover, the scanning should take lot of time which means gathering of data will be for long time and I need to save it temporarily in my controller till my USB talks to it and then I can transfer the file to PC. I hope I put myself in correct words..
ckielstra



Joined: 18 Mar 2004
Posts: 3680
Location: The Netherlands

View user's profile Send private message

PostPosted: Wed Apr 16, 2008 8:17 pm     Reply with quote

We are trying to determine what type of memory is needed. For example, the easiest to use memory is the internal RAM but this will loose it's contents when power is removed. EEPROM doesn't loose it's contents but has other problems.

You already told us the data is coming in at a rate of 1 sample each 30ms, and if possible you would like to speed this up to 1 sample/ms.

To give a good suggestion we need an answer to the following questions:

Quote:
I need to save it temporarily in my controller till my USB talks to it and then I can transfer the file to PC.
How temporarily do you have to store the data?
And is (battery) power available without interruption during this period?

What is the maximum amount of data you have to store before transferring to the PC?
In order to calculate this you need to know:
- The maximum number of sampled coordinates per session.
- The sampling resolution for the Z-coordinate (PIC A/D converter can be set to 8 or 10-bit resolution).
- Number of bytes required for a single X and Y coordinate.
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