Computers and modern gadgets

The ATTiny2313 microcontroller is a revival in a new series of the old AT90S2313 microcontroller, which was quite successful in its time. ATTiny2313 is an improved version of its ancestor. But he also inherited a rather modest periphery. So, in terms of functionality, ATTiny2313 is modest. The microcontroller is available in two versions - regular (ATTiny2313) and with reduced power (ATTiny2313 V). You have to pay for reduced power by lowering the clock frequency of the microcontroller (slower operation).

General characteristics:

  • 120 instructions optimized for programming in high-level languages;
  • 32 general purpose registers (I love this);
  • almost every instruction is executed in 1 clock cycle of the generator, due to which the performance reaches 20 MIPS (20 million operations per second);
  • 2 kilobytes of flash memory for programs. Flash memory can be programmed directly from the controller (itself);
  • 128 bytes EEPROM (non-volatile memory);
  • 128 bytes SRAM (random access memory).

What do we have on board this peripheral chip?

  • one 8-bit timer/counter;
  • one 16-bit timer/counter;
  • four PWM channels;
  • analog comparator;
  • Watchdog timer;
  • USI Universal Serial Interface;
  • USART (this is a computer COM RS232).

Special goodies:

Power, frequency:

1.8 – 5.5V (for ATTiny2313V) up to 10 MHz
2.7 – 5.5V (for ATTiny2313) up to 20 MHz
In operating mode, it consumes 230 µA with a supply of 1.8 V and a master oscillator frequency of 1 MHz. In power-saving mode, Power-down consumes less than 1 µA at 1.8V

Programming

ATTiny2313 managed to survive another revision and acquired a letter A at the end. Among the innovations it should be noted:
— External interruptions appeared on all legs.
— The separation between normal and low-voltage power supply has been removed. ATTiny2313A can be powered from 1.8 to 5.5V, while it is only necessary to comply with frequency restrictions from 4 MHz (for 1.8 V) to 20 MHz.
— Current consumption has been significantly reduced, both in normal mode and in energy saving modes - 190 µA and 0.1 µA, respectively.
Moreover, as a result of the latest revision, ATTiny2313 acquired an older brother ATTiny4313 (without the letter A). The older brother is similar to the ATTiny2313A, with the exception of twice the memory (4 kB Flash, 256 bytes EEPROM, 256 bytes SRAM). These changes show Atmel's intentions to continue to support this microcontroller.

Due to the poor availability and incomprehensible price of the new versions of ATTiny2313A and ATTiny4313, my devices will be developed on the old version of ATTiny2313. But since new versions are compatible with old ones, theoretically, the firmware should work on new microcontrollers.

Conclusions:

Like all AVR microcontrollers of the ATTiny2313 series, it is productive and economical. It has a SOIC case that is convenient for board layout and soldering. The distances between the legs are relatively large (you can even manage to put a trace on the board between adjacent legs). Easy to learn. There is a lot of literature in Russian. Due to the great popularity of its predecessor AT90S2313, many interesting circuits have been developed on the network for repetition. Widely available commercially. Inexpensive. To start studying microcontrollers, this is the place to be. Among the shortcomings, it is worth noting the rather modest peripherals today. And as a downside, the SOIC case is a little big (although I’m already nitpicking). Small amounts of memory will not allow you to create large-scale projects on the ATTiny2313. In general, a good high-performance controller for small projects that do not require special peripherals. I plan to use it quite widely in my devices due to the best availability and low cost.

How to assemble a simple circuit, how to connect a programmer to an ATtiny2313 microcontroller, how to write a simple program in C and how to flash an ATtiny2313 microcontroller with our program, you will find all this in this article.

First of all, we need a programmer, there are many types of programmers, which programmer should we choose?
There are ordinary programmers in which you need to insert a microcontroller, flash it, remove the microcontroller and then insert it into our board to see the result, and this sequence will have to be done hundreds of times at first, this option, in my opinion, is not convenient.
Our microcontroller ATtiny2313 Supports ISP (In-System Programming) function via SPI port, this in-circuit programming use case ISP in my opinion the most convenient and fastest, because... There is no need to remove the microcontroller from our board after each firmware update; you can program the microcontroller hundreds of times and immediately, without disconnecting the programmer from the computer and the board, see the result after flashing the microcontroller; the process of debugging the software of an amateur radio device is noticeably simplified and the time spent on this is reduced.
You can make an in-circuit ISP programmer yourself; there are many simple circuits on the Internet on how to do this via an LPT or COM port, for example a programmer PonyProg You can find diagrams on the Internet on how to make it.

This article will discuss working with an in-circuit ISP programmer for microcontrollers AVR (PX-400) it works via COM port.
If you do not have a COM port on your computer, you will also need an adapter from a USB port to a COM port, there are also many varieties of such adapters, I recommend the adapter that I worked with: UCON-232S USB to Serial port converter board
Photo of the programmer PX-400, adapter UCON-232S USB , Datasheet ATTiny2313

Let's take a closer look at all the details of this scheme:
(Just in case, I bought all the parts, programmer, adapter (from USB to COM port) at chipdip.ru)

1 - PBD-20 board socket 2.54mm 2x10 straight- I did this for convenience, to make it easier to check signals from the microcontroller pins; this point could not be done.
2 - SCS-20 DIP panel 20 pins- we solder the panel to the board so that it is possible to replace the microcontroller in the board if necessary,
ATtiny2313-20PU, DIP20, MCU, 5V, 1K-Flash, 12MHz- We insert the microcontroller into the DIP panel.
3 - Quartz crystal 4.000 MHz (truncated) HC-49S- Quartz crystal 4 MHz
4 - Ceramic capacitor K10-17B imp. 22pF NPO,5%,0805- Two 22pF ceramic capacitors
5 - 78M05 (+5V, 0.5A) TO220- A 5V voltage stabilizer supplies the microcontroller with stabilized power of no more than +5V, in this case I got 4.4V, which is enough.
6 - NP-116 power plug 1.3x3.4x9.5mm MP-331 (7-0026c)- The power plug was soldered to an old mobile phone charger DC 5.7V/800mA
7 - DS-213 power socket on board- where is the power supply for the NP-116 plug, for easy power connection
8 - IDC-10MS (BH-10), straight plug- Plug for connecting an in-circuit ISP programmer
9 - Constant resistor 0.25W 150 Ohm- Three 150 Ohm resistors on the MISO, SCK, MOSI pins
10 - Constant resistor 0.25W 47 Ohm- One 47 Ohm resistor per RESET pin
11 - Tact button h=5mm, TC-0103 (TS-A2PS-130)- RESET button, after pressing the button the program in the microcontroller starts from the beginning, the button could have been omitted.
12 - Green LED d=3mm, 2.5V, 2mA - Performs the function of an indicator, this item could not be done.
13 - Constant resistor 0.25W 110 Ohm- A resistor for the LED so that there is 2V on the LED, this step can be omitted
14 - Two wires connected to the LED, to check signals from the microcontroller pins, this step could not be done
15 - Dip-RM printed breadboard 100x100mm

Points 3 and 4 Work as a single unit, like an external clock generator, these points can be omitted if you do not place high demands on the accuracy and stability of the internal RC Oscillator, the internal RC Oscillator has an error of about 10% and the accuracy may be affected by change temperature.

So you have downloaded and installed Atmel Studio:
Let's launch Atmel Studio and write a simple program in C language blinking an LED:
Click: New project... \ AVR GCC \ C \ C Executable Project
Specify the folder where to save the project and the project name, for example Test1, and click OK.
From the list, select our ATtiny2313 microcontroller and click OK.
We erase everything that appears in the window and paste our program code below:

#define F_CPU 4000000L //Specify the frequency of our external quartz 4 MHz
#include
#include
int main(void)
{
//Set all PORTB pins as outputs
DDRB=0xFF;//Register of the direction of information transfer (1-output, 0-input)
while(1)
{
//Data register PORTB (used to output information)
PORTB=0b00000001;//We supply 1 to port 12 of MK PB0 - turn on the LED
PORTB=0b00000000;//Apply 0 to port 12 of MK PB0 - turn off the LED
_delay_ms(1000);//Delay 1 sec.
}
}

Go to the menu Build\Configuration manager\Active solution configuration\
Choose Release, press Close
We did this so that we could have a folder in the project Release, which I will talk about below.

Click F7, ready, our application has compiled!
To flash the ATtiny2313 microcontroller firmware, we need only one file with the extension HEX
It is located in our project folder: ...
Please note the file Test1.hex just take it from the folder Release !
Do not confuse, because folder Debug there is also a file Test1.hex, but this file still contains debugging information and because of this you will not be able to flash with this file because. it is usually large and will not fit in the memory of the MK.

We found the .hex file, now we need a program to flash the ATtiny2313 microcontroller, there are many such programs, but we will use the program: Avr-Osp II
Download:

We connect the programmer to our circuit, and be sure to supply power to the circuit!

Launch the program Avr-Osp II, specify the path to the file in the FLASH section... \Test1\Test1\Release\Test1.hex, check the boxes in the program and press the button Program that's it, microcontroller ATtiny2313 is flashed!

What is the advantage of in-circuit ISP programmers? Now, without disconnecting the wires from our circuit, you can make changes in the program, and, as described above, flash the microcontroller and immediately see the result.

Please leave questions and comments on our forum

A simple experiment with connecting a button to an AVR microcontroller is described, and a simple C program for processing button presses is analyzed. Let's look at the features of connecting a button to the MK ports, as well as methods for reading button states in the C language.

Previous articles discussed experiments with LEDs that were connected to microcontroller ports configured for Output.

In this article, we will connect a button to the microcontroller, the contacts of which close when pressed, and open when released (closed button).

Schematic diagram of the experiment

In order to be able to at least somehow observe and control something using a button, we will connect two more LEDs to the microcontroller. The diagram is very simple, here it is:

Rice. 1. Schematic diagram of the experiment with the ATtiny2313 microcontroller and button.

As you can see, two LEDs are connected to two ports PB0 and PB1 through limiting resistors, and a button is connected to port PD2 and it also has a limiting resistor. To connect the programmer to the MK, the Conn 1 (AVR-ISP) connector is used, and to connect the circuit to a separate +5V power source, two contacts are used - P1 and P2.

Rice. 2. An experiment diagram with a microcontroller and a button assembled on a solderless breadboard.

It is important to note that for safe use of a port with a button, a resistor with a resistance of 1 KOhm is connected in series with it (you can also connect it to another resistance of 600 Ohms - 2 KOhms). Accept this as a rule of good manners when working with pins, which will protect the MK port from failure in the event of an erroneous high-level supply to the pin and when the button is closed.

Structure of I/O ports in AVR microcontrollers

The microcontroller pins are universal GPIO (General Purpose Input Output), you can connect both actuators (indicators, power switches) and various digital sensors (buttons, switches) to them.

Several pins in the MK can be connected to an ADC/DAC (Analog-to-Digital-Converter and vice versa), with their help you can analyze and generate analog signals. Conventional GPIOs cannot work with analog signals; they can only have 0 (0V) or 1 (+5V) at their input/output.

Each GPIO pin inside the microcontroller is connected to several blocks and electronic components that are useful to know about:

  • Between the port pin and each of the power rails (GND and VCC) connected via diode. They are used to “dampen” short-term interference, voltage surges relative to the pin and each of the power rails;
  • There is also a capacitor between the pin and GND. I don’t know exactly why it is needed, perhaps for protection against interference, to prevent contact bounce when using buttons and switches connected to a pin, or for something else;
  • Connected to each pin an electronic key with a resistor is a pull-up of the pin to the voltage of the power source (Pull-UP). This electronic key is turned on by software and serves to set the default high logical level 1 (+5V) when working with a pin in input mode (Input);
  • Between the pin and each of the power buses (GND and VCC) two more electronic switches (without resistors) are included; they are needed to set a high (+5V) or low (0V) logical level on the pin when the pin is operating in Output mode.

For software control and configuration of each of the ports, three special registers are used, for example for port “B”:

  • DDRB - register (8 bits) for setting the operating modes of pins - input or output. This is done by setting the corresponding bits in the register;
  • PORTB is a register for controlling the state of the port pins in output mode - high or low level. Also used in input mode, used to enable pull-up resistors and set the default input level high;
  • PINB is a register that contains the logical states of the pins on a port, used to read the values ​​of ports that are configured in input mode.

You can learn more about the design of ports for a specific microcontroller model from its datasheet, in the “I/O-Ports” section; there may also be examples of code in C and Assembly for working with ports.

RESET pin as I/O port

It is useful to know that the “RESET” pin of the microcircuit (in our diagram it is pin number 1), which is intended for resetting the execution of the microcontroller program (reboot), can also be used to connect buttons, LEDs and other input/output devices, that is, it can be turned into a regular GPIO.

This can be useful if the microcircuit does not have enough pins for your design. For example, when assembling some device on an ATtiny13 chip (8 pins, 2 pcs for power, 5 pcs for I/O ports, 1 pc for RESET), you found that one pin was missing for the LED. There may be several options to solve the problem:

  1. Reprogramming the RESET pin for an I/O port;
  2. Connecting an LED to one of the adjacent already used pins, using some histrosts in the circuit design and taking into account the possibility of its general use;
  3. Using another MK that has more pins, for example ATtiny2313.

Which of these options is simpler and cheaper in terms of finances/time - judge according to your own case.

To turn the "RESET" pin into an I/O port, you will have to change a special fuse - RSTDISBL (Reset Disable). But before you do this, you need to remember that after this operation, reprogramming the microcontroller will only be possible using a high-voltage programmer (12V); a regular USB ISP or another programmer powered by 5V will no longer be able to do its job.

C program

So, we have one button and two LEDs that are connected to the microcontroller, what can we do with them? - and we’ll do this (algorithm):

  1. After turning on the power, the LEDs will flash alternately and with a delay of 300 milliseconds;
  2. When you press and hold the button, only the blue LED will light;
  3. After releasing the button, the blue LED will flash 3 times with a delay of 500 milliseconds, after which the LEDs will flash alternately again with a delay of 300 milliseconds.

An example of the implementation of such an algorithm in C language under AVR is given below. Let's create a new file for our program and open it for editing:

Nano /tmp/avr-switch-test.c

Let's put the following code in the body of the file:

/* Experiment with a button on ATtiny2313 * https://site */ #define F_CPU 1000000UL // Core frequency = 1 MHz #include #include // -- Macros for controlling LEDs -- #define LED_BLUE_ON PORTB |= (1<< PB0) // Засвечиваем синий диод #define LED_BLUE_OFF PORTB &= ~(1 << PB0) // Гасим синий диод #define LED_RED_ON PORTB |= (1 << PB1) // Засвечиваем красный диод #define LED_RED_OFF PORTB &= ~(1 << PB1) // Гасим красный диод // Основная программа void main(void) { DDRD |= (0 << PD2); // Пин 6 - на вход PORTD |= (1 << PD2); // Включаем подтягивающий (Pull-UP) резистор для пина 6 DDRB |= (1 << PB0); // Пин 12 - на вывод DDRB |= (1 << PB1); // пин 13 - на вывод // -- Бесконечный цикл -- while(1) { _delay_ms(300); // Задержка 300 мс LED_BLUE_ON; // Включаем синий диод LED_RED_OFF; // Гасим красный диод _delay_ms(300); LED_RED_ON; // Включаем красный диод LED_BLUE_OFF; // Гасим синий диод if(!(PIND & (1 << PD2))) { // Проверяем нажата ли кнопка _delay_ms(50); // Задержка 50 мс (дребезг контактов) LED_RED_OFF; LED_BLUE_ON; while(!(PIND & (1 << PD2))); // Ждем пока кнопка не будет отпущена _delay_ms(500); // Дальше мигаем синим диодом LED_BLUE_OFF; _delay_ms(500); LED_BLUE_ON; _delay_ms(500); LED_BLUE_OFF; _delay_ms(500); LED_BLUE_ON; _delay_ms(500); LED_BLUE_OFF; _delay_ms(200); } // Конец блока работы с кнопкой } // Конец блока с вечным циклом }

First of all we ask constant F_CPU, which will indicate to the compiler the operating frequency of the microcontroller core; this is necessary for some subroutines and functions to work correctly. In our example, we use the time delay function - "_delay_ms" from the "util/delay.h" library, which calculates the time spent on idle cycles, based on the value in the F_CPU constant.

You can view the code of the "delay" library for organizing a time delay and which uses the F_CPU constant in GNU Linux using any text editor, for example, you can run the following command:

Nano /usr/lib/avr/include/util/delay.h

The factory set frequency of the internal RC oscillator in the ATtiny2313 microcontroller is 8000000Hz (8MHz), the frequency division fuse is also set by default - CKDIV8 (Clock Divide by 8), so the actual operating frequency of the crystal = 8000000Hz / 8 = 1000000Hz = 1MHz.

You can see what fuses are installed in the microcontroller using avrdude or a graphical shell for it called AVR8 Burn-O-Mat.

Further in the program, macros are defined to control the state of the ports to which the LEDs are connected: LED_BLUE_ON, LED_BLUE_OFF, LED_RED_ON, LED_RED_OFF. By calling a similar macro anywhere in the program, we can very easily turn on or turn off each of the LEDs, without having to repeat its code, which in turn will simplify the program and make it more visual.

In the main program "void main(void)" we start with the port configuration:

  • DDRD |= (0<< PD2) - установка разряда PD2 регистра DDRD на ввод, к нему подключена кнопка (пин 6);
  • PORTD |= (1<< PD2) - включение подтягивающего резистора для пина к которому привязан разряд PD2 регистра PORTD (пин 6);
  • DDRB |= (1<< PB0) - установка разряда PB0 в регистре DDRB на вывод, к нему подключен СИНИЙ светодиод (пин 12);
  • DDRB |= (1<< PB1) - установка разряда PB1 в регистре DDRB на вывод, к нему подключен КРАСНЫЙ светодиод (пин 13).

Next, using macros, we turn off the red LED and turn on the blue one. Now, using another eternal loop, but with a condition, we will wait until the button is released: "while(!(PIND & (1<< PD2)));".

When the button is released, a high level will appear on pin 6 (this will be done by the internal pull-up resistor that we turned on earlier), and logical 1 will be set in the PD2 bit of the PIND register.

After this, the blue LED flashes three times (on-off) with a delay of 0.5 seconds and the main eternal cycle starts working in a new way - two LEDs will light up alternately.

A very simple program, but nevertheless, it is a good example and grounds for further experiments.

Setting up Geany for ATtiny2313

In previous publications I conducted experiments with the ATMega8 microcontroller, but here I use a less “stuffed” MK - ATTiny2313.

To compile the program and flash it into the MK, you need to slightly reconfigure the commands for assembly in the Geany integrated programming environment.

Go to the Build menu - Set Build Commands. In the compilation command (C commands), you need to change the model of the chip used: "-mmcu=attiny2313". In the command to flash the MK, you need to change the chip type for avrdude: "-p t2313".

Rice. 3. Reconfiguring Geany to work with the ATTiny2313 microcontroller.

All commands are given for GNU Linux OS; if you have Windows, you may have to enter the full paths to the binary files “avr-gcc.exe”, “avr-objcopy.exe”, “avrdude.exe”.

I discussed in more detail how to configure Geany in GNU Linux in one of the previous articles in the series.

Compilation and firmware of the program in MK

Compiling, assembling and flashing the program can be done by clicking three buttons in turn in the Geany environment: “Compile”, “Build” and “Run”. Also, all these operations can be performed from the console, here are the commands for these actions (perform sequentially):

Avr-gcc -mmcu=attiny2313 -Os /tmp/avr-switch-test.c -o /tmp/avr-switch-test.o avr-objcopy -j .text -j .data -O ihex /tmp/avr- switch-test.o /tmp/avr-switch-test.hex avrdude -c usbasp -p t2313 -P usb -U flash:w:/tmp/avr-switch-test.hex

All commands are almost completely (with the exception of file name substitutions) identical to those that we corrected in the Geany settings.

Conclusion

Despite the simplicity of the experiment, I also tried to highlight some very important technical aspects of working with ports; the knowledge and experience provided will be useful in further study and work with ATMEL microcontrollers.

Today we will try to use a simpler microcontroller ATtiny2313 and connect to it a character LCD display containing two lines of 16 characters.

We will connect the display in the standard 4-bit way.

First, let's start, of course, with the microcontroller, since we are already very familiar with the display from previous lessons.

Let's open the controller datasheet ATtiny2313 and let's see its pinout

We see that this controller exists in two types of cases, but since I got it in a DIP package, we will consider this particular version of the case, and in principle, they do not differ much, except in appearance, so how the number of legs is the same - 20 each.

Since there are 20 legs compared to the 28 legs of the ATMega8 controller, which we have been working on all along and will continue to work on, then, accordingly, there will also be fewer possibilities.

In principle, everything that the ATmega8 had is here, the only thing is that there are fewer port claws. But since the task before us is to try to connect it via the SPI bus with another controller, this does not depress us much.

There are some other differences, but they are minor and we will get to know them as needed.

Let's put together a circuit like this (click on the picture to enlarge the image)

The display is connected to the pins of port D. PD1 and PD2 are to the control inputs, and the rest are connected to the pins of the display module D4-D7.

Let's create a project with the name TINY2313_LCD, transfer everything into it except the main module from the project for connecting the display to Atmega8.

Of course, some things will need to be redone. To do this, you need to carefully study which leg is connected to what. The E bus of the display is connected to PD2, and the RS bus is connected to PD1, so let's make changes to the file lcd.h

#definee1PORTD|=0b0000 01 00 // set line E to 1

#definee0PORTD&=0b1111 10 11 // set line E to 0

#definers1PORTD|=0b00000 01 0 // set the RS line to 1 (data)

#definers0PORTD&=0b11111 10 1 // set the RS line to 0 (command)

As we can see from the bold font, we have not had such drastic changes.

Now information inputs. Here we use legs PD3-PD6, that is, they are shifted by 1 point compared to the connection to Atmega8, so we will also correct something in the file lcd.c in function sendhalfbyte

PORTD&=0b 1 0000 111; // erase information on inputs DB4-DB7, leave the rest alone

But that is not all. We previously shifted the transmitted data by 4, but now, due to the above changes, we will only have to shift it by 3. Therefore, in the same function we will also correct the very first line

c<<=3 ;

That's all the changes. Agree, they are not that great! This is achieved by the fact that we always try to write universal code and use macro substitutions. If we had not spent time on this at one time, we would have had to correct the code in almost all the functions of our library.

In the main module, we do not touch the initialization of port D; let the whole module go into the output state, as in lesson 12.

Let's try to assemble the project and first see the result in Proteus, since I also made a project for it, which will also be in the attached archive with the project for Atmel Studio

Everything works great for us! This is how you can quickly remake a project for one controller for another.

Proteus is very good, but it’s always nicer to look at real details. The entire circuit was assembled on a breadboard, since I did not make or assemble a debug board for this controller. We will connect the programmer via a standard connector like this

Here's the whole diagram

Everything is standard here. Pull-up resistor to RESET, etc.

Now, before flashing the controller in avrdude, we need to select the controller and read its flash memory

Then go to the FUSES tab and set the fuses correctly. Since we don’t have a quartz resonator, we install the fuses this way


Characteristics:

  • AVR RISC architecture
  • AVR - high quality and low power RISC architecture
    120 instructions, most of which are executed in one clock cycle
    32 8-bit general purpose working registers
    Completely static architecture
  • RAM and non-volatile program and data memory
    2 KB of self-programmable Flash program memory capable of withstanding 10,000 write/erase cycles
    128 Bytes system-programmable EEPROM data memory capable of withstanding 100,000 write/erase cycles
    128 Bytes of built-in SRAM memory (static RAM)
    Programmable protection against reading Flash program memory and EEPROM data memory
  • Peripheral characteristics
    One 8-bit timer/counter with separate prescaler
    One 16-bit timer/counter with separate prescaler, compare circuit, capture circuit and two PWM channels
    Built-in analog comparator
    Programmable watchdog timer with built-in oscillator
    USI - Universal Serial Interface
    Full duplex UART
  • Microcontroller Special Features
    Built-in debugWIRE debugger
    In-system programming via SPI port
    External and internal interrupt sources
    Low consumption modes Idle, Power-down and Standby
    Improved power-on reset circuitry
    Programmable power failure detection circuitry
    Built-in calibrated generator
  • I/O ports and housing design
    18 programmable I/O lines
    20 pin PDIP, 20 pin SOIC and 32 pin MLF packages
  • Supply voltage range
    from 1.8 to 5.5 V
  • Operating frequency
    0 - 16 MHz
  • Consumption
    Active mode:
    300 µA at 1 MHz and 1.8 V supply voltage
    20 µA at 32 kHz and 1.8 V supply voltage
    Low consumption mode
    0.5 µA at 1.8 V supply voltage


General description:

ATtiny2313 is a low-power 8-bit CMOS microcontroller with AVR RISC architecture. By executing instructions in a single cycle, the ATtiny2313 achieves 1 MIPS performance at 1 MHz clock speed, allowing the designer to optimize the power-to-performance ratio.

The AVR core integrates a rich instruction set and 32 general purpose working registers. All 32 registers are directly connected to the Arithmetic Logic Unit (ALU), allowing access to two independent registers while executing a single instruction. As a result, this architecture allows for tens of times greater performance than standard CISC architecture.

ATtiny2313 has the following characteristics: 2 KB Flash programmable program memory, 128 byte EEPROM data memory, 128 byte SRAM (static RAM), 18 general-purpose I/O lines, 32 general-purpose working registers, one-wire interface for the built-in debugger, two flexible timer/counter with comparison circuits, internal and external interrupt sources, programmable serial USART, universal serial interface with start condition detector, programmable watchdog timer with built-in oscillator, and three software-initialized low-power modes. In Idle mode, the core stops, but RAM, timers/counters, and the interrupt system continue to function. In Power-down mode, the registers retain their values, but the generator stops, disabling all device functions until the next interrupt or hardware reset. In Standby mode, the master oscillator runs while the rest of the device is idle. This allows the microprocessor to start up very quickly while maintaining power when idle.

The device is manufactured using high-density non-volatile memory technology from Atmel. The built-in ISP Flash allows you to reprogram the program memory in the system via a serial SPI interface or with a conventional non-volatile memory programmer. By combining an 8-bit RISC core with self-programming Flash memory into a single chip, the ATtiny2313 is a powerful microcontroller that provides greater flexibility to the microprocessor system designer.

The ATtiny2313 is supported by a variety of software and integrated development tools such as C compilers, macro assemblers, software debuggers/simulators, in-circuit emulators, and evaluation kits.

If you notice an error, select a piece of text and press Ctrl+Enter
SHARE:
Computers and modern gadgets