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 support@ccsinfo.com

A simple way to make datalogging in the kilobyte range.
Goto page 1, 2  Next
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
davidbue



Joined: 05 Nov 2007
Posts: 28
Location: Denmark

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

A simple way to make datalogging in the kilobyte range.
PostPosted: Wed Oct 29, 2008 2:40 am     Reply with quote

Hello everybody!

I need some of you code gurus to help me design my datalogging interface. Laughing

It's for an eco-car at our university, that runs more than 300 km/l = 706 miles per gallon fuel-equivalent to gasoline. Being a student of mechanical engineering, (with micro-controllers as a small hobby of mine), I'm on deep water with this one.

I need to log 6 x 16bit integers every second, for an hour. That must run up to 60*60*16*6 = 345 600 bytes -> roughly 350 kb of data right?

That's WAY more that I can store on my internal eeprom on the pic18f2220 that I use, so I must look around for some external storage media.

I was looking at CompactFlash cards, but it seems to be overkill for this job, and It's waaaay to complicated for me :-)


Any suggestions on an easier, simpler, and less complicated way to do the job. I kinda hope that there is some small external RAM module that I can write to, pretty much the same way as with the internal eeprom, and that there is some wirering + code examples out there!

Any help is greatly appreciated.

Have a really nice day!
David
treanla
Guest







Serial flash perhaps ?
PostPosted: Wed Oct 29, 2008 3:24 am     Reply with quote

Take a look at Winbonds Serial flash range. Simple SPI interface and available in large sizes.
Maybe that could do the trick for you.
Rohit de Sa



Joined: 09 Nov 2007
Posts: 282
Location: India

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

PostPosted: Wed Oct 29, 2008 3:36 am     Reply with quote

There are external EEPROMs which you can use. Microchip has both SPI and I2C EEPROMs. None are larger than 1Mbit, so to log over 350 KB you'd need at least two. Cypress Semi also has NV Memory. The good thing is that they are 4Mbit in size and some even have a 16bit storage word, so that may ease things a bit for you. Have a look at the CY14B104.

Microchip:
http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=80

Cypress:
http://www.cypress.com/products/?gid=5&fid=25&GoGatewayCategoryID=All&

Rohit
Wayne_



Joined: 10 Oct 2007
Posts: 681

View user's profile Send private message

PostPosted: Wed Oct 29, 2008 3:36 am     Reply with quote

Your calculation is wrong.

16 bit int = 2 bytes so 60 (min) * 60 (sec) * 6 (ints) * 2(bytes) = 43200 Bytes. (~43KB)

A lot smaller than your value Smile
Rohit de Sa



Joined: 09 Nov 2007
Posts: 282
Location: India

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

PostPosted: Wed Oct 29, 2008 3:38 am     Reply with quote

Haha, Wayne

Nicely caught! I completely missed that! Razz

Rohit
dyeatman



Joined: 06 Sep 2003
Posts: 1931
Location: Norman, OK

View user's profile Send private message

PostPosted: Wed Oct 29, 2008 6:45 am     Reply with quote

You might try Ramtron Serial FRAM memory. They have no delays for writes
like regular EEProm does and handle a lot more write cycles. I have used a lot of these and they make writing
to external memory much faster....

http://www.ramtron.com/
Guest








PostPosted: Wed Oct 29, 2008 8:38 am     Reply with quote

345,600 kbits = 43200KBytes.

I was looking at some of these winbond ICs, and if I understand their operation correctly, you have to write a full page at once. You cannot just write an arbitrary amount of data to them. Is the page size the sector size? If so, I don't see how most pics will be able to use these chips, as the sector size for all of these chips is 4KB. The original poster's chip only has 512 bytes of ram. So unless you are storing the data in program memory, how would this work?

Or am I just way off base?
dbotkin



Joined: 08 Sep 2003
Posts: 197
Location: Omaha NE USA

View user's profile Send private message Send e-mail Visit poster's website

PostPosted: Wed Oct 29, 2008 8:49 am     Reply with quote

If money is not the issue but time is, throw a VDIP1 module at it. Plug in a USB FLASH drive and write a CSV file to it via serial from the PIC using printf(). Then you can unplug the FLASH drive, plug it into your laptop and have the data already in a file. VDIP1 is set up to talk to USB mass storage and HID devices, costs $24.50 in singles from Mouser or Digi-Key.
asmallri



Joined: 12 Aug 2004
Posts: 1634
Location: Perth, Australia

View user's profile Send private message Send e-mail Visit poster's website

PostPosted: Wed Oct 29, 2008 11:25 am     Reply with quote

dyeatman wrote:
You might try Ramtron Serial FRAM memory. They have no delays for writes
like regular EEProm does and handle a lot more write cycles. I have used a lot of these and they make writing
to external memory much faster....

http://www.ramtron.com/


But in this case a standard multi-sourced EEPROM is more than good enough as the data rate and total storage requirement is low.
_________________
Regards, Andrew

http://www.brushelectronics.com/software
Home of Ethernet, SD card and Encrypted Serial Bootloaders for PICs!!
treanla
Guest







Comment to guest
PostPosted: Thu Oct 30, 2008 3:27 am     Reply with quote

You do not have to program a whole page of 256 bytes at once with the winbonds spi flash.Look at the page program function in the datasheet.
Guest








Re: Comment to guest
PostPosted: Thu Oct 30, 2008 10:17 am     Reply with quote

treanla wrote:
You do not have to program a whole page of 256 bytes at once with the winbonds spi flash.Look at the page program function in the datasheet.


So one page is 256 bytes. A program instruction can write up to 256 bytes in a previously erased page. So if you have 1000 pages, but only write 1 byte per program instruction, you can only store 1000 bytes, right?
Ttelmah
Guest







PostPosted: Thu Oct 30, 2008 10:33 am     Reply with quote

No.
The point is that you erase a whole page (256 bytes).
You can then write bytes to the whole of this page in any order you want to the individual bytes, without performing another erase (so long as you don't want to overwrite a byte already written). Once the page is full (256bytes written), you can then start on the next page.

However it really all doesn't matter for this application. As has been pointed out by a couple of other posters, the data size, and rate required, just isn't that high. you could use an ordinary EEPROM, and even at 4mSec/byte (most modern EEPROMs are faster than this), 6*2byte integers per second, is only going to take 48mSec/second to write. Not exactly a problem. The total data required, is small enough, to fit into a 512Mbit EEPROM. If you use one of the standard '512' parts with a 64byte page, you can just write 60 bytes every five seconds to the chip, starting on a 64byte boundary (ignoring the extra four bytes available), and perform a single write for the whole block. Quick, easy, and cheap.

Best Wishes
Wayne_



Joined: 10 Oct 2007
Posts: 681

View user's profile Send private message

PostPosted: Thu Oct 30, 2008 10:37 am     Reply with quote

Flash devices generally erase to all 1s.
When writing, you can write without erase as long as you are converting a 1 to a zero or leaving it as a 1. If you need to change a bit from a 0 to a 1 you need to perform an erase.
An erase is usually performed on a block (256 bytes).

If you have 1000 blocks and erased the first block (256 bytes). you can then write 1 byte to each of the first 256 addresses without another erase. you can do this one byte at a time or several or all 256 bytes.
You can then usually change a byte in that block without erase if you follow the above rule. If you need to convert a bit from a zero to a 1 you have to erase the block and re-write the data.

You can usually erase the whole device in one go or individual blocks.

With some memory management you can optimise the writing of your data with minimal erases.
davidbue



Joined: 05 Nov 2007
Posts: 28
Location: Denmark

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

Thank you!!
PostPosted: Thu Oct 30, 2008 11:25 am     Reply with quote

Thank you everybody for all the responses. I'll look into the different approaches, and try to decide what to do!

Best reagards!
johnjohn7188



Joined: 29 Oct 2008
Posts: 8
Location: Irvine, CA

View user's profile Send private message AIM Address

PostPosted: Thu Oct 30, 2008 2:17 pm     Reply with quote

Why don't you look into NAND Flash? I've written code to drive NAND Flash with a PIC24H. It writes VERY fast and costs very little. You have to write PAGES and erase BLOCKS with NAND Flash. Just make sure you load all your data to RAM before writing it. Micron makes really good and cheap NAND Flash.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 
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