Professional Documents
Culture Documents
Experiment 2
Experiment 2
Experiment 2
2.1.2 Schematics
Arduino Mega 2560 is open-source hardware! You can build your own board using the files
given in the documentation. Visit Arduino Mega 2560 documentation page for more details.
2.1.3.2 SRAM
SRAM or Static Random Access Memory, can be read and written from your executing program.
SRAM memory is used for several purposes by a running program:
Static Data - This is a block of reserved space in SRAM for all the global and static variables
from your program. For variables with initial values, the runtime system copies the initial value
from Flash when the program starts.
Heap - The heap is for dynamically allocated data items. The heap grows from the top of the
static data area up as data items are allocated.
Stack - The stack is for local variables and for maintaining a record of interrupts and function
calls. The stack grows from the top of memory down towards the heap. Every interrupt, function
call and/or local variable allocation causes the stack to grow. Returning from an interrupt or
function call will reclaim all stack space used by that interrupt or function.
Most memory problems occur when the stack and the heap collide. When this happens, one or
both of these memory areas will be corrupted with unpredictable results. In some cases, it will
cause an immediate crash. In others, the effects of the corruption may not be noticed until much
later.
2.1.3.3 EEPROM
EEPROM is another form of non-volatile memory that can be read or written from your
executing program. It can only be read byte-by-byte, so it can be a little awkward to use. It is
also slower than SRAM and has a finite lifetime of about 100,000 write cycles (you can read it as
many times as you want).
2.1.4 Bootloader
Microcontrollers are usually programmed through a programmer unless you have a piece of
firmware in your microcontroller that allows installing new firmware without the need of an
external programmer. This is called a bootloader.
If you want to use the full program space (flash) of the chip or avoid the bootloader delay, you
can burn your sketches using an external programmer.
To burn the bootloader, you'll need to buy an AVR-ISP (in-system programmer), USBtinyISP or
build a ParallelProgrammer. The programmer should be connected to the ICSP pins (the 2 by 3
pin header) - make sure you plug it in the right way. The board must be powered by an external
power supply or the USB port.
The term UART actually refers to the onboard hardware that manages the packaging and
translation of serial data. For a device to be able to communicate via the UART protocol, it must
have this hardware! On the Arduino Mega, there is one serial port dedicated for communication
with the computer the Arduino is connected to. That’s right! USB, which stands for Universal
Serial Bus, is a serial port! On the Arduino Mega, this USB connection is broken out through
onboard hardware into two digital pins, GPIO 0 and GPIO 1, which can be used in projects that
involve serial communication with electronics other than the computer.
UART is called asynchronous because the communication does not depend on a synchronized
clock signal between the two devices attempting to communicate with each other. Because the
communication speed is not defined via this steady signal, the “sender” device cannot be certain
that the “receiver” obtains the correct data. Therefore, the devices break data into fixed-size
chunks to ensure that the data received is the same as the data that was sent.
● Above 2v - considered as 1.
When connecting a component to a digital pin, make sure that the logic levels match. If the
voltage is in between the thresholds, the returning value will be undefined.
In Arduino, the PWM enabled pins produce a constant frequency of ~ 500Hz, while the duty
cycle changes according to the parameters set by the user. See the following illustration:
PWM signals are used for speed control of DC motors, dimming LEDs and more.
Describe the difference between Flash Memory and SRAM of microcontroller. Write down
the items that you use in your daily life which utilizes Flash Memory.
What is the advantage of EEPROM? When you will use EEPROM in your
microcontroller?
What are the disadvantages of uploading code using Arduino Bootloader? How you can
avoid it?