Hide minor edits - Show changes to markup
[@
@]
There are three pools of memory in the microcontroller used on Arduino boards (ATmega168):
Flash memory and EEPROM memory are non-volatile (the information persists after the power is turned off). SRAM is volatile and will be lost when the power is cycled.
The ATmega168 chip has the following amounts of memory:
Existen 3 fuentes de memoria en el microcontrolador utilizado por la placa Arduino (ATmega168):
La memoria Flash y EEPROM son no-volatiles (la información se mantiene en ellas luego de cortar la alimentación). SRAM es volatíl y se perdera al reiniciar la unidad.
El chip ATmega168 cuenta con las siguientes cantidades de memoria:
Flash 16k bytes (of which 2k is used for the bootloader)
Flash 16k bytes (de los que 2k son utilizados por el bootloader)
Notice that there's not much SRAM available. It's easy to use it all up by having lots of strings in your program. For example, a declaration like:
char message[] = "I support the Cape Wind project.";
puts 32 bytes into SRAM (each character takes a byte). This might not seem like a lot, but it doesn't take long to get to 1024, especially if you have a large amount of text to send to a display, or a large lookup table, for example.
If you run out of SRAM, your program may fail in unexpected ways; it will appear to upload successfully, but not run, or run strangely. To check if this is happening, you can try commenting out or shortening the strings or other data structures in your sketch (without changing the code). If it then runs successfully, you're probably running out of SRAM. There are a few things you can do to address this problem:
Ten en cuenta que no hay mucha SRAM disponible. Es fácil utilizarla toda al tener muchas cadenas (strings) en tu programa. Por ejemplo, una declaración como:
char message[] = "Ah, qué hermoso..., qué hermoso."
pone 32 bytes en la SRAM (cada caracter utiliza un byte). Esto pude no parecer mucho, pero no toma mucho más llegar hasta 1024, especialmente si tienes largas cantidades de texto que enviar a una pantalla, o una tabla de datos muy grande, por ejemplo.
Si se te acaba la SRAM, tu programa fallara de manera improvista; parecera subir a la placa de manera correcta, pero no se ejecutara, o se ejecutara de manera extraña. Para comprobar si esto es lo que sucede, puedes intentar comentado o acortando las cadenas de texto u otras estructuras de datos en tu sketch (sin alterar el código). Si entonces este funciona correctamente, es probable que el problema haya sido la SRAM llena. Hay unas pocas cosas que puedes hacer para solucionar este problema:
To use the EEPROM, see the EEPROM library.
Para utilizar la EEPROM, consulta la biblioteca EEPROM.
To use the EEPROM, see the EEPROM library.
To use the EEPROM, see the EEPROM library.
puts 32 bytes into SRAM (each character takes a byte). It doesn't take long to get to 1024, especially if you have a large amount of text to send to a display, or a large lookup table, for example.
puts 32 bytes into SRAM (each character takes a byte). This might not seem like a lot, but it doesn't take long to get to 1024, especially if you have a large amount of text to send to a display, or a large lookup table, for example.
One thing you will notice in the chart above is that there is a lot more Flash (program) memory than SRAM available. When you create variables with the Arduino language such as:
Notice that there's not much SRAM available. It's easy to use it all up by having lots of strings in your program. For example, a declaration like:
You are putting 32 bytes (1 char = 1 byte) into SRAM. 32 bytes isn't a lot of memory in a pool of 1024 bytes, but if the sketch requires some large data structures - such as a large amount of text to send to a display, or a large lookup table, for example - using flash memory (program memory) for storage may be the only option. To do this, use the PROGMEM keyword.
puts 32 bytes into SRAM (each character takes a byte). It doesn't take long to get to 1024, especially if you have a large amount of text to send to a display, or a large lookup table, for example.
If you run out of SRAM, your program may fail in unexpected ways; it will appear to upload successfully, but not run, or run strangely. To check if this is happening, you can try commenting out or shortening the strings or other data structures in your sketch (without changing the code). If it then runs successfully, you're probably running out of SRAM. There are a few things you can do to address this problem:
There are three pools of memory in the microcontrollers used on Arduino boards (e.g. the ATmega168):
There are three pools of memory in the microcontroller used on Arduino boards (ATmega168):
There are three pools of memory in the microcontrollers used on Arduino boards (e.g. the ATmega168):
Flash memory and EEPROM memory are non-volatile (the information persists after the power is turned off). SRAM is volatile and will be lost when the power is cycled.
The ATmega168 chip has the following amounts of memory:
Flash 16k bytes (of which 2k is used for the bootloader) SRAM 1024 bytes EEPROM 512 bytes
One thing you will notice in the chart above is that there is a lot more Flash (program) memory than SRAM available. When you create variables with the Arduino language such as:
char message[] = "I support the Cape Wind project.";
You are putting 32 bytes (1 char = 1 byte) into SRAM. 32 bytes isn't a lot of memory in a pool of 1024 bytes, but if the sketch requires some large data structures - such as a large amount of text to send to a display, or a large lookup table, for example - using flash memory (program memory) for storage may be the only option. To do this, use the PROGMEM keyword.
To use the EEPROM, see the EEPROM library.