vimwiki/tech/arduino_nano.wiki

88 lines
1.9 KiB
Plaintext

= Arduino Nano =
A very small arduino product, better for hobby embedding
see [[arduino_techniques|Programming Techniques]]
== Features ==
* ATMEL AVR ATmega328P microcontroller
* 8 bit @16Mhz
* 2Kbytes SRAM
* 32Kbytes flash
* 1Kbytes EEPROM
* Three on board LED's * 20 IO pins
* 6 PWM and 6 ADC
== Notes ==
* WHEN UPLOADING BE SURE TO SET BOARD TO ATMEGA328OLD
- this is the atmega328old for BOARD_SUB in the makefile
=== Memory ===
* AVR instructions are 16 or 32bits wide, therefore the flash is 16K x 16
* EEPROM has endurance of ~10000 write cycles
* Program counter is 14 bits wide
* First 32 memory locations (0x0000 - 0x001F) are registers
* Next 64 registers are standard IO (0x0020 - 0x005F)
* Next 160 are extended IO (0x0060 - 0x00FF)
* Everything else is SRAM (0x0100 - 0x08FF)
=== IO ===
* GPIO pins
* Have a Data Direction Register (DDR)
- Sets if data should go in or out
* Is kept up via a [[multiplexer]] to decide which bit
=== Pins ===
Pins are controller by the atmega's ports. Each port has different port
registers. Each bit of the 8 bit register controls a single pin. Port D
controls pins 0 through 7, C controls the analog pins, and B controls 8 through
13
* PortC
- Port C data regiser
- 0x28
- R/W 8bits
* DDRC
- Port C data direction register
- 0x27
- R/W 8bits
* PINC
- Port C input pints address
- 0x26
- R 8bits
* PortB
- Port B data register
- 0x25
- R/W 8bits
* DDRB
- Port B data direction register
- 0x24
- R/W 8bits
* PINB
- Port B Input pins address
- 0x23
- R 8bit
Same pattern:
* PortD
- 0x2B - 0x29
=== Interrupts ===
Interrupts are the same as OS typical interrupts, controlled by the Interrupt
lookup table. On this device the ILT is instead a control register.
=== Clock ===
The ATMega328P has 3 timers, two 8bit timers and one 16bit timer. These timers
can be used for PWM for motors and the like.
[[embedded]]