ATtiny2313 is one of the small Flash technology-based microcontrollers based on RISC architecture. An integrated IC with GPIO pins, processor, memory, and other peripherals. A low-power, hi-tech chip introduced by Microchip has a speed of 12 million instructions per second and a data EEPROM of 128 Bytes. It finds its applications from domestic devices to the industrial level to provide digital control to systems.
This tutorial is an introduction to the ATtiny2313 microcontroller. All the features, specifications, pin configuration, operation of GPIO pins, and applications will be discussed here.
ATtiny2313 Introduction
ATtiny2313 AVR microcontroller is an 8-bit microcontroller with an internal oscillator of 4 MHz. It has 20 pins, out of which 18 are GPIO pins, debugWIRE debugging attribute, port, and a USART port for serial interfacing different sensors and electronic components. It also has an inbuilt Watchdog timer to function while in energy-saving mode.
ATtiny2313 Pinout
Following diagram shows the pinout of the ATtiny2313 AVR Microcontroller:
ATtiny2313 Pin Configuration
Let us discuss the pinout of the ATtiny 2313 AVR microcontroller. The pin configuration detail in tabular is mentioned below:
Number | Pin Name | Function |
---|---|---|
1 | Reset/dW/PA2 | PortA2/Reset/debug wire pin |
2 | PD0/RXD | Dual I/O PortD0/UART Reception pin |
3 | PD1/TXD | Dual I/O PortD1/UART Transmission pin |
4 | PA1/XTAL2 | PortA1/Oscillator out pin |
5 | PA0/XTAL1 | PortA0/Oscillator in pin |
6 | CKOUT/XCK/INT0/PD2 | Clock Output/USART Clock/Interrupt0/Dual I/O PortD2 pin |
7 | PD3/INT1 | Dual I/O PortD3/Interrupt1 pin |
8 | PD4/T0 | Dual I/O PortD4/Timer0 output pin |
9 | PD5/OC0B/T1 | Dual I/O PortD5/Output compare B output/TImer1 pin |
10 | GND | Ground |
11 | PD6/ICP | Dual I/O PortD6/Input Capture pin |
12 | PB0/AIN0/PCINT0 | Dual I/O PortB0/Analog comparator0/Pin change interrupt0 pin |
13 | PB1/AIN1/PCINT1 | Dual I/O PortB1/Analog comparator1/Pin change interrupt1 pin |
14 | PB2/OC0A/PCINT2 | Dual I/O PortB2/Output compare0 A/Pin change interrupt2 pin |
15 | PB3/OC1A/PCINT3 | Dual I/O PortB3/Output compare1 A/Pin change interrupt3 pin |
16 | PB4/OC1B/PCINT4 | Dual I/O PortB4/Output compare1 B/Pin change interrupt4 pin |
17 | PB5/MOSI/DI/SDA/PCINT5 | Dual I/O PortB5/MOSI/SDA/Pin change interrupt2 pin |
18 | PB6/MISO/DO/PCINT6 | Dual I/O PortB6/MISO/Data output/Pin change interrupt6 pin |
19 | PB7/UCSK/SCL/PCINT7 | Dual I/O PortB7/universal serial interface/SCL/Pin change interrupt7 pin |
20 | VCC | Power supply pin |
- GPIO pins: It has a total of 20 GPIO pins, out of which 18 are input-output pins and 3 ports
- Interrupts: Interrupts are subroutines used to execute particular instructions before routine instructions.
- Oscillators/XTAL: ATtiny2313 has an internal oscillator of 4 MHz, but it can be customized by providing a clock through external oscillators pin for fast processing
- MOSI/MISO: These pins are for serial communication and interfacing of controllers and devices.MOSI is used to send data from the microcontroller to peripherals, whereas MISO is used to receive data.
- ICP: Input capture pin is used to capture for pulse measurement of timers
- dW: It is used to control the program execution flow by reading and writing to all memory blocks
UART Pins
UART | Pin number |
---|---|
RXD | PD0 |
TXD | PD1 |
Externall Interrrupt Pins
Interrupt Number | Pin number |
---|---|
INT0 | PD3 |
INT1 | PD4 |
UART Pins
SPI Pins | Pin number |
---|---|
MOSI | PB5 |
MISO | PB6 |
SCK | PB7 |
I2C Pins
UART | Pin number |
---|---|
SDA | PB5 |
SCL | PB7 |
ATtiny2313 Features and Specifications
Features and Peripherals | Availability |
---|---|
Architecture | RISC |
Pin Count | 20 |
SRAM | 128 Bytes |
EEPROM/HEF | 128 Bytes |
Program Memory | 2 KiloBytes |
CPU speed | 20 MHz (max) |
Internal Oscillator | 4 MHz |
Number of Comparators | 1 |
ADC | No |
DAC | No |
USB module | No |
Peripheral Pin select | No |
PWM channels | 4 |
Resolution of PWM | 1024 |
Number of Timers | 2 |
12C module | 1 |
UART module | 1 |
Cap touch Channels | 4 |
Window watchdog timer (WWDT) | No |
ATtiny2313 Microcontroller Specifications
- DataBus Width : 8bits
- Pin Count : 20 (PDIP/SOIC/MLF/QFN)
- Processor Speed: 12 Million Instructions per Second
- Program Memory: 2 KB
- StaticRAM: 128 bytes
- Data EEPROM: 128 Bytes
- PWM channels: 4
- Operational Temperature : -400C – 850C
ATtiny2313 Peripherals
Some of the detailed features listed as follows:
- high-performance CMOS microcontrollers with Flash Technology
- operates at a wide range of 2.7 – 5.5 volts, so it is power-efficient
- Inbuilt Brown Out detection circuit for urgency
- operational frequency is up to 4MHz but can be altered for saving energy
- 32X8 general purpose registers
- It comes with an external and internal reset option
- 3 power modes, i.e., idle mode, power-down mode, and standby mode
- Has internal/external interrupts and 2 different timers
- An SPI, USART port for serial programming
- Watchdog timer to work and wake the device up from sleep mode and can be activated or deactivated through programming
- 8-bit RISC architecture based CPU
- 120 instructions set per cycle
- Electrically Erasable Memory programmable Read-Only Memory of 125×8 bytes to store some of the data permanently
How to Program ATtiny2313 AVR Microcontroller
Different software and compilers available in the market can be used to program ATtiny2313 AVR microcontrollers.
Support Compilers
We need an IDE, IPE, a suitable compiler, and a programmer/debugger to develop a program. The function of an IDE(Integrated Development Environment) is to provide the environment for programming. The compiler converts the program into readable HEX files. The IPE(Integrated Programming Environment) serves the purpose of burning HEX files in AVR MCUs.
- IDE: Atmel Studio 7
- Compiler: AVR and ARM Toolchains
Assembly Language is still functional for programming. Some of the most commonly used compilers are Micro C for AVR, AVR, and ARM Toolchains provided by Atmel’s manufacturers, known as Microchip itself.
Atmel-ICE is an In-circuit programmer/debugger which plays an integral role in programming AVR. It supports In-Circuit-Serial-Programming, operated by a computer, to burn the code into ATtiny2313 AVR using Atmel Studio. Furthermore, hardware like Perfboard, soldering station, Crystal Oscillator, capacitors, AVR IC is required.
Alternative Microcontrollers
- ATtiny2313A (equivalent)
- ATmega8515
- ATmega8535
- ATmega645A
- ATmeg6490
- ATmega8a
- ATmega88PA
- ATtiny28L
- ATtiny48
- ATtiny417
Applications
- Sensor Systems
- Medical systems
- Home automation systems
- Low-cost embedded systems
- Automobiles
- Defense and safety purposes
2D Diagram
ATtiny2313 8-bit AVR Microcontroller comes in three packages, i.e., 20P3, the 20S, and 20M1. The following figure shows the 2d model of ATtiny2313 8-bit AVR Microcontroller(20P3). It shows us the physical dimensions of the components required when a PCB card is designed.
Other AVR Microcontrollers:
- ATMEGA328P Microcontroller
- ATmega16 Microcontroller
- ATMega32 Microcontroller
- ATtiny45 MICROCONTROLLER
- ATtiny88 Microcontroller
- ATtiny85 Microcontroller
AVR Microcontroller Tutorials:
- GETTING STARTED WITH AVR MICROCONTROLLER
- ATMEL STUDIO 6 TUTORIAL step by step guide
- LED BLINKING using ATMEGA32 AVR micrcontroller
- How to use push button with ATMEGA32 AVR microcontroller
- LCD interfacing with ATMEGA32 AVR MICROCONTROLLER
- DC motor interfacing with atmega32 and L293
- DS18S20 interfacing with pic and avr microcontroller
- how to use timers of avr microcontroller