ATtiny2313 8-bit AVR Microcontroller

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 pinout diagram 8-bit 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:

NumberPin NameFunction
1Reset/dW/PA2PortA2/Reset/debug wire pin
2PD0/RXDDual I/O PortD0/UART Reception pin
3PD1/TXDDual I/O PortD1/UART Transmission pin
4PA1/XTAL2PortA1/Oscillator out pin
5PA0/XTAL1PortA0/Oscillator in pin
6CKOUT/XCK/INT0/PD2Clock Output/USART Clock/Interrupt0/Dual I/O PortD2 pin
7PD3/INT1Dual I/O PortD3/Interrupt1 pin
8PD4/T0Dual I/O PortD4/Timer0 output pin
9PD5/OC0B/T1Dual I/O PortD5/Output compare B output/TImer1 pin
10GNDGround
11PD6/ICPDual I/O PortD6/Input Capture pin
12PB0/AIN0/PCINT0Dual I/O PortB0/Analog comparator0/Pin change interrupt0 pin
13PB1/AIN1/PCINT1Dual I/O PortB1/Analog comparator1/Pin change interrupt1 pin
14PB2/OC0A/PCINT2Dual I/O PortB2/Output compare0 A/Pin change interrupt2 pin
15PB3/OC1A/PCINT3Dual I/O PortB3/Output compare1 A/Pin change interrupt3 pin
16PB4/OC1B/PCINT4Dual I/O PortB4/Output compare1 B/Pin change interrupt4 pin
17PB5/MOSI/DI/SDA/PCINT5Dual I/O PortB5/MOSI/SDA/Pin change interrupt2 pin
18PB6/MISO/DO/PCINT6Dual I/O PortB6/MISO/Data output/Pin change interrupt6 pin
19PB7/UCSK/SCL/PCINT7Dual I/O PortB7/universal serial interface/SCL/Pin change interrupt7 pin
20VCCPower 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

UARTPin number
RXDPD0
TXDPD1

Externall Interrrupt Pins

Interrupt NumberPin number
INT0PD3
INT1PD4

UART Pins

SPI PinsPin number
MOSIPB5
MISOPB6
SCKPB7

I2C Pins

UARTPin number
SDAPB5
SCLPB7

ATtiny2313 Features and Specifications

Features and PeripheralsAvailability
ArchitectureRISC
Pin Count20
SRAM128 Bytes
EEPROM/HEF128 Bytes
Program Memory2 KiloBytes
CPU speed20 MHz (max)
Internal Oscillator4 MHz
Number of Comparators1
ADCNo
DACNo
USB moduleNo
Peripheral Pin selectNo
PWM channels4
Resolution of PWM1024
Number of Timers2
12C module1
UART module1
Cap touch Channels4
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.

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.

ATtiny2313 8-bit AVR Microcontroller minimal circuit

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.

ATtiny2313 2D Diagram

Other AVR Microcontrollers:

AVR Microcontroller Tutorials:

Leave a Comment