Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Memory type for microcontrollers

Status
Not open for further replies.

mfa682

New Member
Hi,

I'm new to programming and a bit confuse with microcontroller's memory. I'm currently working on thermocouple project but I dont know which microcontroller to be used. The project requires the data (temperature) to be recorded in every 2 seconds interval for about one week (which means there will be about 302400 data of temperature stored and lets assume the data is "int" type in C language).

The question is, what kind of memory will the data be stored in? What memory should I refer when looking for the microcontroller that meets the requirement? Is it FLASH memory, EEPROM, or something else? Can anyone recommend the suitable microcontroller?

Sorry for asking, thanks in advance. Your help is really appreciated.
 

Diver300

Well-Known Member
Most Helpful Member
Microcontrollers have RAM and Flash Memory.

There is less RAM, and its contents is lost when the power is lost, but you can write to it quickly and as many times as you like.

The Flash Memory is what the program is stored in, and its contents remains when the power is lost. You can only write to it 10,000 to 1,000,000 times, and it is slow to write to, taking 2 - 10 ms. Because the program is stored in the Flash Memory, writing to it will cause the program to pause.

EEPROM is only on some microcontrollers, and there isn't much of it, not enough for what you want. It is easier to write to than the Flash, and doing so doesn't pause the program although the time taken is just as long. EEPROM also has a limited life, but often larger than than for the Flash Memory.

In the PIC range there are only a few 32 bit microcontrollers, such as the PIC32MX340F512H that have enough memory for all the readings you want. As those devices have lots of pins and are only available in surface mount, I would suggest that they are not really suitable for your project.

I think that you would be better with a simpler microcontroller like the 16F628, combined with an external EEPROM chip such as the 25LC1024. You can easily connect several of those to a microcontroller to give you as much memory as you need. You could also put the data on an SD card.
 

kpatz

New Member
Use an I2C EEPROM (or multiple EEPROMs) with the capacity you need.

"int" in C is typically 16 or 32 bits. What kind of precision do you need on your temperature readings? The more precision, the more bytes you'll need.
 

mfa682

New Member
In the PIC range there are only a few 32 bit microcontrollers, such as the PIC32MX340F512H that have enough memory for all the readings you want. As those devices have lots of pins and are only available in surface mount, I would suggest that they are not really suitable for your project.

I think that you would be better with a simpler microcontroller like the 16F628, combined with an external EEPROM chip such as the 25LC1024. You can easily connect several of those to a microcontroller to give you as much memory as you need. You could also put the data on an SD card.

Thanks for the complete answer. Other than PIC, can ATMEGA family be connected with an external EEPROM chip or SD card in order to expand its memories? Is it possible? I'm more familiar with ATMEGA microcontroller but not with PIC family.
 
Last edited:

mfa682

New Member
Use an I2C EEPROM (or multiple EEPROMs) with the capacity you need.

"int" in C is typically 16 or 32 bits. What kind of precision do you need on your temperature readings? The more precision, the more bytes you'll need.

Looks like the external EEPROM chip is the answer. I dont really know the precision but the accuracy of the measurement should be plus/minus 1 degree.
 
Last edited:

Noggin

Member
ATMega can easly be connected to EEPROM. I'd suggest SPI over I2C since you're new to programming. In my experience, SPI is a little bit easier to understand and to get working.
 

kpatz

New Member
Looks like the external EEPROM chip is the answer. I dont really know the precision but the accuracy of the measurement should be plus/minus 1 degree.
What's the temperature range you're measuring? 1 byte (char in C) can hold 0 thru 255, or -128 to +127, which should be enough for a Celsius or Fahrenheit temperature with whole numbers (no decimal).
 

Russ Hensel

New Member
Every 2 seconds is pretty fast. If temperature changes slowly most reading will be the same. If so there are many ways to compress the data. Or change the measuring method: record the number of seconds that have elapsed since the temperature went up or down or stayed the same. If data is changing slowly this could result in storing data only every 60 seconds or so. If data changed fast it would use one byte per second.
 

mfa682

New Member
What's the temperature range you're measuring? 1 byte (char in C) can hold 0 thru 255, or -128 to +127, which should be enough for a Celsius or Fahrenheit temperature with whole numbers (no decimal).

Sorry, I forgot to list the temperature range at the beginning. The range is from 0 to 350 degree Celcius.
 

mfa682

New Member
ATMega can easly be connected to EEPROM. I'd suggest SPI over I2C since you're new to programming. In my experience, SPI is a little bit easier to understand and to get working.

From my understanding, SPI is a way to communicate the microcontroller to PC right? Will the SPI allow the stored temperature to be downloaded to the PC?
 
Last edited:

Noggin

Member
It is not very common to use SPI to communicate with the PC. Easiest way would be to use RS-232 to communicate with the PC.

Use SPI to load the data into and out of the EEPROM and use RS-232 to a serial port on the PC to get the data to it. If you don't have a serial port on the PC, you can use a USB to RS-232 cable, or put a USB to RS-232 chip on your board.
 

mfa682

New Member
It is not very common to use SPI to communicate with the PC. Easiest way would be to use RS-232 to communicate with the PC.

Use SPI to load the data into and out of the EEPROM and use RS-232 to a serial port on the PC to get the data to it. If you don't have a serial port on the PC, you can use a USB to RS-232 cable, or put a USB to RS-232 chip on your board.

If thats the case, can the microcontroller programmed through RS-232 only (without using SPI connection)? Also, is it OK to use the same SPI port for interfacing EEPROM and parallel-port ISP?
 

Noggin

Member
You can program it through RS-232 after you've programmed a bootloader into it.

Are you looking at AVR's for your microcontroller? (You may have said that already, but I didn't see it) Many AVR's use the same pins for SPI as they do for ISP. Although they might be on the same pins, they are very different, so don't get the two confused. I got them confused on the ATMega128 and ended up not being able to program my part :)

SPI - Serial Peripherial Interface - Used to communicate with many types of devices such as EEPROM, sensors, keypads, other microcontrollers, etc
ISP - In-System Programer - Used to program the MCU while it is installed on a circuit board. In the case of the AVR, these pins may be shared with the SPI port.

It is OK to use EEPROM on the SPI port and use a programmer to program the device on the ISP pins. You should have your ISP connector run directly to the microcontroller and tie the pins through resistors to the EEPROM chip. Don't forget a pullup on your EEPROMs chip select so that your programmer doesn't give it a ton of bad instructions while its programming the MCU.
 

mfa682

New Member
You can program it through RS-232 after you've programmed a bootloader into it.

Are you looking at AVR's for your microcontroller? (You may have said that already, but I didn't see it) Many AVR's use the same pins for SPI as they do for ISP. Although they might be on the same pins, they are very different, so don't get the two confused. I got them confused on the ATMega128 and ended up not being able to program my part :)

SPI - Serial Peripherial Interface - Used to communicate with many types of devices such as EEPROM, sensors, keypads, other microcontrollers, etc
ISP - In-System Programer - Used to program the MCU while it is installed on a circuit board. In the case of the AVR, these pins may be shared with the SPI port.

It is OK to use EEPROM on the SPI port and use a programmer to program the device on the ISP pins. You should have your ISP connector run directly to the microcontroller and tie the pins through resistors to the EEPROM chip. Don't forget a pullup on your EEPROMs chip select so that your programmer doesn't give it a ton of bad instructions while its programming the MCU.

Ok, now everything makes sense. Thanks for your help. Your help is really appreciated! =)

Now i will be googling how to get the bootloader done, or just use the ISP line instead til the end. Thanks again.
 
Status
Not open for further replies.

Latest threads

EE World Online Articles

Loading
Top