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

Efficient writing to program memory

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



Joined: 19 May 2010
Posts: 2

View user's profile Send private message

Efficient writing to program memory
PostPosted: Thu May 27, 2010 10:55 am     Reply with quote

I'm currently designing a muscle impulse recorder which is to be worn by a moth in flight. I have a pair of instrumentation amplifiers feeding into a PIC16F1936's analog input. I need to be able to record 8-bit input at ~1000 Hz sampling rate from both amplifiers for three to four seconds and store this data until I instruct the PIC to send out the data via serial. Since size and weight are critically important, I intend to store the data in the PIC's program memory but I am unsure of the most efficient way to do this- especially since my attempts to write to large blocks of reserved memory (using #ORG) seem to be very slow.

I am aware that this will rapidly use consume the 100,000 write limit of the memory. This, however, is not a major concern as long as a few minutes of operation are available. The system is designed to be disposable after that time.

If necessary, the sampling rate can be decreased but must not be less than 750 Hz. Read speed is not a major concern since I have several minutes to collect the stored data via my serial connection.

Is write_program_memory capable of satisfying the design requirements and, if so, what is the most efficient way of handling the data storage?
Gabriel



Joined: 03 Aug 2009
Posts: 1067
Location: Panama

View user's profile Send private message

PostPosted: Thu May 27, 2010 11:52 am     Reply with quote

i cant help you.... but i just wanted to say: thats awesome!!!....

wish i could see the moth with the PIC onboard.

g
_________________
CCS PCM 5.078 & CCS PCH 5.093
Ttelmah



Joined: 11 Mar 2010
Posts: 19499

View user's profile Send private message

PostPosted: Thu May 27, 2010 2:29 pm     Reply with quote

The problem will be the write time of the EEPROM. Typically 2mSec/byte, and 'worst case', 2.5mSec/byte. Would limit the maximum guaranteed rate to just 400bytes/sec. You need 2KB/sec (to handle two channels at 1000 samples/sec).
I did a similar logging unit some time ago, ended up using the smallest cheapest PIC I could find with the ADC, and added an FRAM memory. These have far better write time (just the time taken to clock the data in), so were much more comfortable for the application.

Best Wishes
Rohit de Sa



Joined: 09 Nov 2007
Posts: 282
Location: India

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

PostPosted: Thu May 27, 2010 7:36 pm     Reply with quote

A moth? Wow! That is insane! Razz I would suggest using the smallest package PIC, maybe a 10F220 in a SOT23 with a TSSOP memory chip.

As PCM suggested, FRAM chips are a nice option. http://www.ramtron.com/products/nonvolatile-memory/serial.aspx

You could try serial SRAM http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=2698
The memory would give you only 8 seconds of data, assuming a 4KBps data rate.

I'd love to see what you're doing. Do post a link to pictures (if its not top secret James Bond spy stuff Razz )

Rohit
arunb



Joined: 08 Sep 2003
Posts: 492
Location: India

View user's profile Send private message Send e-mail

PostPosted: Thu May 27, 2010 11:34 pm     Reply with quote

a moth can carry all that ?? PIC and a FRAM ?

Wonder what the moth is thinking about all this ?
Ttelmah



Joined: 11 Mar 2010
Posts: 19499

View user's profile Send private message

PostPosted: Fri May 28, 2010 2:14 am     Reply with quote

In my case, the animal was fractionally larger. However we used the core 'chip', not the 'IC'. You buy what is basically the silicon wafer, just split up, and bond this directly onto your substrate. The total electronics was about 0.1g in weight. The hardest thing was power. For the unit I was involved with, this was fed in by an induction loop. For some large moths I can see it being relatively easy, but for some of the smaller species, I'd hate to be trying to do this!....

Best Wishes
Wayne_



Joined: 10 Oct 2007
Posts: 681

View user's profile Send private message

PostPosted: Fri May 28, 2010 3:14 am     Reply with quote

Another option (if you can get a small enough one) would be to use a PIC18 series device with more ram.Store the data in ram and as long as there is a supply to it you won't loose it.

A quick look showed the maximum size was 4K minus the amount required for your variables you may just have enough.

You would need a trigger to start the sampling such as a level on the ADC or just when supply is applied. And stop when the ram is full.
Milton



Joined: 19 May 2010
Posts: 2

View user's profile Send private message

PostPosted: Fri May 28, 2010 7:57 am     Reply with quote

For those interested, he's a picture of the previous version. This was small enough to be carried by the animal but it had to be powered by a bench power supply attached with wires. By cutting the size/weight in half or so, we're hoping to have enough remaining payload capacity to add a battery. The moth can carry ~.750g total.


Uploaded with ImageShack.us

Thanks for the responses. I have measured the write time for 8bytes and I get fairly long and inconsistent results so I believe your suggestions about external memory are the way to go.

Future requirements (a few digital I/O) preclude the use of the PIC 10 series but It seems like the 12F683 in a 3x3 DFN package should be suitable.

Eventually, we would like to replace the PCB/chips with epoxy-covered wafers. As the system continues to evolve, I'm hoping to go that direction for our smallest animals.


Last edited by Milton on Fri May 28, 2010 8:40 am; edited 1 time in total
Gabriel



Joined: 03 Aug 2009
Posts: 1067
Location: Panama

View user's profile Send private message

PostPosted: Fri May 28, 2010 8:13 am     Reply with quote

man, where do you work? are you hiring? hahahaha
freaking wicked!
_________________
CCS PCM 5.078 & CCS PCH 5.093
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