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

External memory with pic 16f877a

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



Joined: 28 Dec 2011
Posts: 2
Location: Pakistan

View user's profile Send private message

External memory with pic 16f877a
PostPosted: Fri Dec 30, 2011 4:22 am     Reply with quote

hello,

I am new with ccs and micro controllers. I am designing a data logger based on pic micro-controller. I am using pic 16f877a, ccs c compiler. I want to save voltage values from different sensors and save them in external memory. I'm confused in selecting memory. Can anybody guide me in choosing a memory which must be able to save at least 500 values. I'm in component choosing phase.
freedom



Joined: 10 Jul 2011
Posts: 54

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

PostPosted: Fri Dec 30, 2011 6:30 am     Reply with quote

First we have to know about your value of voltage.
As example, volt= 0 to 255 , then you need int8 datatype variable, if you have more than this then you need int16 or int 32 datatype.
How much memory you need, that depends on how many data you want to save as well as their datatype.

you can declare separate variable for each sensor

Here is a program concept

Code:


#include <16F877A.H>
#fuses XT, NOWDT, NOPROTECT, BROWNOUT, PUT, NOLVP
#use delay(clock = 8000000)
#include <2432.c>  // here is your memory device / EEPROM
#include <external_eeprom.c> // Utilities to write various data types to external eeprom

 int8  sensor1_volt;  // declare global variable

void main()
{
  // condition to read your data (volt)

   init_ext_eeprom(); // to initialize EEPROM

  sensor1_volt=read_ext_eeprom(0x0000); // to read data (volt) from EEPROM

while(true)
  {

    // condition , while you want to write/save volt data to EEPROM

   write_ext_eeprom(0x000, sensor1_volt); // write or save data (volt) to EEPROM

       
  }
}
temtronic



Joined: 01 Jul 2010
Posts: 9177
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Fri Dec 30, 2011 6:49 am     Reply with quote

Also need to know what you're going to do with the data !

If its something the PIC will use later, then some small external EEPROM will work fine but if the data is to go to a PC, then perhaps a USB flashdrive is better.

ADC readings are either 8 or 10 bit, if using 10 bit, they use 16 bits or 2 bytes of storage( double that of 8 bit readings), so you'll need a bigger device.You don't say how many sensors are used.

The speed of the readings/storing of data is important.EEPROM is slow compared to USB,again you know the numbers, we don't.

As this is a 'data logger' then each reading(or set) should have a 'time stamp'(when the reading took place. That will take more storage space which takes more time to write the data.

Also with multiple sensors, you'll have to figure out which data came from which sensor.
asmboy



Joined: 20 Nov 2007
Posts: 2128
Location: albany ny

View user's profile Send private message AIM Address

PostPosted: Fri Dec 30, 2011 1:46 pm     Reply with quote

if you use 74LVC translation - ( 3.3v rated )
you might consider microchips SPI RAM
such as the 23K256
....as a very low overhead way to address 32k bytes of static ram
Ttelmah



Joined: 11 Mar 2010
Posts: 19382

View user's profile Send private message

PostPosted: Fri Dec 30, 2011 1:48 pm     Reply with quote

Or, FRAM.
Much faster writing, than any of the other memories that hold their contents when unpowered.

Best Wishes
temtronic



Joined: 01 Jul 2010
Posts: 9177
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Fri Dec 30, 2011 1:51 pm     Reply with quote

oh oh ..another 5 volt PIC 3 volt peripheral 'challenge', more parts and wiring, things to go wrong...endless debugging cause 'they' think they can cheat with resistors.....

still think vinny and flash is the way to go IF you need to log and transfer data to another computer.

then again the 20 year old board I was just working on had 64KB of Sony static RAM.....
farhanhaseeb



Joined: 28 Dec 2011
Posts: 2
Location: Pakistan

View user's profile Send private message

PostPosted: Mon Jan 09, 2012 9:02 pm     Reply with quote

Thanx for all the help, but I also want to save the time stamp (the time of value along with date). I'm using ds1307 ic for this purpose along with pic. I'm also interested in saving in external usb device. I'm having four sensors and my input values will be within 0-5 volts.
John P



Joined: 17 Sep 2003
Posts: 331

View user's profile Send private message

PostPosted: Tue Jan 10, 2012 6:02 pm     Reply with quote

The easiest way has to be a serial EEPROM.

Saving to a USB device is a problem. You mean make the PIC processor look like the computer end of a USB line? That's very difficult to do. But you might be able to make a dual-port memory setup, with (let's say) your PIC16F877A communicating with it on one side, and USB on the other. I think if that's necessary, you'd be better off learning to use one of the PIC18 devices that plug directly into USB, and make that processor do everything, reading the sensors and running the memory, and forget the PIC16F877A.
temtronic



Joined: 01 Jul 2010
Posts: 9177
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Tue Jan 10, 2012 6:23 pm     Reply with quote

John P ... Using USB with a PIC is very easy,at least a LOT easier than interfacing a 5 volt PIC to a 3 volt eeprom .
By using the Vinculum II series you get BOTH the abilty to use a flash drive for easy data logging with simple commands. It uses easy serial commands to store the data. NO overhead for FAT file drivers,'drive' commands like create,erase,creating sub directories,etc.Since NO drivers are in the PIC, you gain valuable code space.
With respect to interfacing to a PC, the 'drivers' to allow an 18F4550 to talk to a PC via the builtin USB interface take 1/3 of the code space.That's a huge amount!. By letting the Vinculum II do all the work and handle the USB 'details', you get that whole 1/3 of memory back to use!
Yes, it comes at a cost., about $24 for a complete DIP style module that has 2 USB ports.Since the Vinculum II is programmable it can be used to play music,be a host,be a slave,access other USB devices,or even a 'simple' USB-serial interface.It is a tremendously powerful 'peripheral'.
As for the OP request for 'external memory' that implied to me, that the data should be available to say a PC for 'downloading'. That means some kind of 'memory stick' and by using the Vinculum, the PIC can store the data via simple serial commands into a CSV file. It takes less time to cut that code than me typing this 'two finger' reply.
dalexdisuja



Joined: 21 Feb 2014
Posts: 1

View user's profile Send private message

Interfacing external EEPROM with PIC Microcontroller
PostPosted: Fri Feb 21, 2014 9:55 am     Reply with quote

hi i googled and get a very good website Where i found post on Interfacing external EEPROM with PIC Microcontroller via i2c protocol with FM24C64 and the code which they given in post which i tested and working fine. i give that link may it help you. http://www.nbcafe.in/interfacing-external-eeprom-with-pic-microcontroller/
asmboy



Joined: 20 Nov 2007
Posts: 2128
Location: albany ny

View user's profile Send private message AIM Address

PostPosted: Fri Feb 21, 2014 11:06 am     Reply with quote

i use this item in a number of products, to capture VAST amounts of
data -sent via PIC TTL serial port.

how does using a CHEAP removable MICRO-SD 4GB card sound ? Very Happy Very Happy

https://www.sparkfun.com/products/9530
ckielstra



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

View user's profile Send private message

PostPosted: Fri Feb 21, 2014 8:47 pm     Reply with quote

This a 2 year old thread !!!
Please stop posting in the old threads as the original poster has long gone. It took me reading till the last message until I realised it was an old thread and I wasted my time.
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