AVR I/O memory operations

Publisher:chinalisaLatest update time:2020-02-09 Source: eefocusKeywords:AVR Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

All I/O registers can be accessed through the IN (I/O port input) and OUT (output to I/O port) instructions. These instructions are used to transfer and exchange data between the 32 general registers and the I/O register space, and the instruction cycle is 1 clock cycle. In addition, the registers (the first 32) with an address range of $00-$1F can also be used to implement bit operations and bit judgment jumps. The SBI (specified position in the I/O register is set to 1) and CBI (specified bit in the I/O register is cleared to zero) instructions can directly perform bit operations on each bit in the I/O register. Using the SBIS (jump if the specified bit in the I/O register is 1) and SBIC (jump if the specified bit in the I/O register is 0) instructions can verify and judge the values ​​of each bit in these I/O registers, and implement a jump to skip an instruction and execute the next instruction.


I/O register addresses $OO to $3F are used in the I/O register-specific instructions IN, OUT, SBI, CBI, SBIS, and SBIC.


When addressing an I/O register in SRAM mode, you must add $0020 to its address to map it to the address in the data memory space. In this book, I/O register addresses are given in two address representations: the I/O register space address and the mapped address in the data memory space (in parentheses).


Replenish:


All I/O and peripherals of the ATmega128 are placed in the I/O space. All I/O locations can be accessed through the IN and OUT instructions, which transfer data between the 32 general working registers and the I/O. The I/O registers have addresses from 0x00 to 0x1F. You can also use the SBI and CBI instructions to directly address a bit, while SBIS and SBIC are used to check the value of a specific bit. For more information, see the instruction set. When using the IN and OUT instructions, the address must be between 0x00 and 0x3F. If you want to access the I/O registers through the LD and ST instructions like SRAM, add 0x20 to the corresponding address.

Keywords:AVR Reference address:AVR I/O memory operations

Previous article:AVR microcontroller learning C language running light verification
Next article:AVR MCU Learning ATmega16 ADC

Recommended ReadingLatest update time:2024-11-16 14:26

AVR microcontroller reset circuit
AVR microcontroller reset circuit Design of AVR reset circuit Compared with the traditional 51 MCU, AVR MCU has built-in reset circuit, and the reset time can be controlled in the fuse position. Therefore, AVR MCU can reset normally and work stably without external power-on reset circui
[Microcontroller]
Analysis of lighting and CO2 control system based on AVR chip
1. Project Overview 1.1 Introduction A greenhouse is a place that can change the growth environment of plants, create optimal conditions for plant growth, and avoid the influence of seasonal changes and bad climate on them. It uses light-collecting covering materials as all or part of the structural materials, and can
[Microcontroller]
Analysis of lighting and CO2 control system based on AVR chip
AVR Fuse Bits Quick Start
AVR uses fuses to control some functions inside the chip, such as JTAG, clock usage, power-off detection voltage, whether debugging is allowed, etc. The STK500 in AVR Studio has a huge advantage in handling fuse bits: it allows users to configure them in the form of functional combinations. Compared with PnoyPr
[Microcontroller]
AVR Fuse Bits Quick Start
Analysis of I2C driver of linuxok6410 --- user mode driver
3 i2c-dev 3.1 Overview When introducing the I2C subsystem, we mentioned using the i2c-dev.c file to implement our I2C slave device driver in the application. However, it implements a virtual, temporary i2c_client, which is generated when the device file is opened and revoked when the device file is c
[Microcontroller]
AVR MCU password lock program
This is a password lock implemented by AVR microcontroller. It consists of 16 hardware matrix keyboards, digital tubes and buzzers. The correct initial password of the system is 0, 1, 2, 3. When we press the key less than 4 times, the system will judge whether the password is correct or not. When the password is cor
[Microcontroller]
51, Comparison of PIC and AVR microcontrollers
1. Traditional 51         I don't think I will say much about the traditional 51. It is suitable for beginners, easy to use, and the price is average (in terms of cost performance).         Disadvantages: easy to decrypt (the traditional 51 says: who let us debut early, everyone is studying me, hey! Cry...) It also h
[Microcontroller]
How to reduce power consumption of ATtiny13
There are several issues to consider when trying to reduce power consumption in an AVR controlled system. In general, sleep modes should be used as much as possible and as few modules as possible should be left operational. Unnecessary functions should be disabled. The following modules require special consideration t
[Microcontroller]
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号