⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 eeprom.lst

📁 winAVR编写的MEGA16内部EEPROM读写程序
💻 LST
📖 第 1 页 / 共 3 页
字号:
   1               		.file	"eeprom.c"
   2               		.arch atmega16
   3               	__SREG__ = 0x3f
   4               	__SP_H__ = 0x3e
   5               	__SP_L__ = 0x3d
   6               	__tmp_reg__ = 0
   7               	__zero_reg__ = 1
   8               		.global __do_copy_data
   9               		.global __do_clear_bss
  11               		.text
  12               	.Ltext0:
  78               	.global	buff
  79               	.global	buff
  80               		.section .bss
  83               	buff:
  84 0000 0000 0000 		.skip 8,0
  84      0000 0000 
  85               		.text
  87               	.global	main
  89               	main:
   1:eeprom.c      **** /*
   2:eeprom.c      ****  * 内部EEPROM读写实验程序,用winavr的库函数eeprom.h里的函数访问eerpom,系统重启一次数码管显示加1
   3:eeprom.c      ****  * EasyAVR-M16 开发板例程
   4:eeprom.c      ****  * CopyRights @ EES
   5:eeprom.c      ****  * Author:ken
   6:eeprom.c      ****  * Date:2007-8-20
   7:eeprom.c      **** */
   8:eeprom.c      **** 
   9:eeprom.c      **** // CLOCK: 7.3728MHZ
  10:eeprom.c      **** 
  11:eeprom.c      **** #include <avr/io.h>
  12:eeprom.c      **** #include <avr/eeprom.h>
  13:eeprom.c      **** #include "disp.h"
  14:eeprom.c      **** #include "type.h"
  15:eeprom.c      **** 
  16:eeprom.c      **** 
  17:eeprom.c      **** uchar buff[8]={0,0,0,0,0,0,0,0};                          //8位显示缓冲区
  18:eeprom.c      **** 
  19:eeprom.c      **** 
  20:eeprom.c      **** int main(void)
  21:eeprom.c      **** {
  91               	.LM1:
  92               	/* prologue: frame size=6 */
  93 0000 C0E0      		ldi r28,lo8(__stack - 6)
  94 0002 D0E0      		ldi r29,hi8(__stack - 6)
  95 0004 DEBF      		out __SP_H__,r29
  96 0006 CDBF      		out __SP_L__,r28
  97               	/* prologue end (size=4) */
  22:eeprom.c      ****   uchar aa;
  23:eeprom.c      ****   
  24:eeprom.c      ****   DispPortInit();
  99               	.LM2:
 100 0008 0E94 0000 		call DispPortInit
 101               	.L2:
  25:eeprom.c      ****   /*
  26:eeprom.c      **** 	//EEPROM区 变量定义法访问
  27:eeprom.c      **** 	uchar eeprom_val __attribute__((section(".eeprom")));  //定义EEPROM变量
  28:eeprom.c      **** 	eeprom_busy_wait();                                    //等待EEPROM读写就绪
  29:eeprom.c      ****   aa=eeprom_read_byte(eeprom_val);                       //读取EEPROM 0地址的内容到aa中
  30:eeprom.c      ****   eeprom_busy_wait();                                    //等待EEPROM读写就绪
  31:eeprom.c      **** 	//PORTB=~aa;
  32:eeprom.c      ****   aa++;
  33:eeprom.c      ****   eeprom_busy_wait();                                    //等待EEPROM读写就绪
  34:eeprom.c      **** 	eeprom_write_byte(eeprom_val, aa);                     //把aa值写到EEPROM 0地址处
  35:eeprom.c      ****   eeprom_busy_wait();                                    //等待EEPROM读写就绪
  36:eeprom.c      **** 	*/
  37:eeprom.c      **** 	//直接指定EEPROM地址法
  38:eeprom.c      **** 	eeprom_busy_wait();                                    //等待EEPROM读写就绪
 103               	.LM3:
 104 000c 8091 3C00 		lds r24,60
 105 0010 9927      		clr r25
 106 0012 8270      		andi r24,lo8(2)
 107 0014 9070      		andi r25,hi8(2)
 108 0016 0097      		sbiw r24,0
 109 0018 09F0      		breq .L3
 110 001a F8CF      		rjmp .L2
 111               	.L3:
 112               	.LBB2:
 114               	.Ltext1:
   1:C:/WinAVR/avr/include/avr/eeprom.h **** /* Copyright (c) 2002, 2003, 2004 Marek Michalkiewicz
   2:C:/WinAVR/avr/include/avr/eeprom.h ****    Copyright (c) 2005, 2006 Bjoern Haase
   3:C:/WinAVR/avr/include/avr/eeprom.h ****    All rights reserved.
   4:C:/WinAVR/avr/include/avr/eeprom.h **** 
   5:C:/WinAVR/avr/include/avr/eeprom.h ****    Redistribution and use in source and binary forms, with or without
   6:C:/WinAVR/avr/include/avr/eeprom.h ****    modification, are permitted provided that the following conditions are met:
   7:C:/WinAVR/avr/include/avr/eeprom.h **** 
   8:C:/WinAVR/avr/include/avr/eeprom.h ****    * Redistributions of source code must retain the above copyright
   9:C:/WinAVR/avr/include/avr/eeprom.h ****      notice, this list of conditions and the following disclaimer.
  10:C:/WinAVR/avr/include/avr/eeprom.h **** 
  11:C:/WinAVR/avr/include/avr/eeprom.h ****    * Redistributions in binary form must reproduce the above copyright
  12:C:/WinAVR/avr/include/avr/eeprom.h ****      notice, this list of conditions and the following disclaimer in
  13:C:/WinAVR/avr/include/avr/eeprom.h ****      the documentation and/or other materials provided with the
  14:C:/WinAVR/avr/include/avr/eeprom.h ****      distribution.
  15:C:/WinAVR/avr/include/avr/eeprom.h **** 
  16:C:/WinAVR/avr/include/avr/eeprom.h ****    * Neither the name of the copyright holders nor the names of
  17:C:/WinAVR/avr/include/avr/eeprom.h ****      contributors may be used to endorse or promote products derived
  18:C:/WinAVR/avr/include/avr/eeprom.h ****      from this software without specific prior written permission.
  19:C:/WinAVR/avr/include/avr/eeprom.h **** 
  20:C:/WinAVR/avr/include/avr/eeprom.h ****   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  21:C:/WinAVR/avr/include/avr/eeprom.h ****   AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  22:C:/WinAVR/avr/include/avr/eeprom.h ****   IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  23:C:/WinAVR/avr/include/avr/eeprom.h ****   ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
  24:C:/WinAVR/avr/include/avr/eeprom.h ****   LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  25:C:/WinAVR/avr/include/avr/eeprom.h ****   CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  26:C:/WinAVR/avr/include/avr/eeprom.h ****   SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  27:C:/WinAVR/avr/include/avr/eeprom.h ****   INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  28:C:/WinAVR/avr/include/avr/eeprom.h ****   CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  29:C:/WinAVR/avr/include/avr/eeprom.h ****   ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  30:C:/WinAVR/avr/include/avr/eeprom.h ****   POSSIBILITY OF SUCH DAMAGE. */
  31:C:/WinAVR/avr/include/avr/eeprom.h **** 
  32:C:/WinAVR/avr/include/avr/eeprom.h **** /* $Id: eeprom.h,v 1.17.2.1 2006/02/26 21:51:04 aesok Exp $ */
  33:C:/WinAVR/avr/include/avr/eeprom.h **** 
  34:C:/WinAVR/avr/include/avr/eeprom.h **** /*
  35:C:/WinAVR/avr/include/avr/eeprom.h ****    eeprom.h
  36:C:/WinAVR/avr/include/avr/eeprom.h **** 
  37:C:/WinAVR/avr/include/avr/eeprom.h ****    Contributors:
  38:C:/WinAVR/avr/include/avr/eeprom.h ****      Created by Marek Michalkiewicz <marekm@linux.org.pl>
  39:C:/WinAVR/avr/include/avr/eeprom.h ****      eeprom_write_word and eeprom_write_block added by Artur Lipowski 
  40:C:/WinAVR/avr/include/avr/eeprom.h ****      <LAL@pro.onet.pl>
  41:C:/WinAVR/avr/include/avr/eeprom.h ****      Complete rewrite using the original interface by Bjoern Haase 
  42:C:/WinAVR/avr/include/avr/eeprom.h ****      <bjoern.haase@de.bosch.com>. 
  43:C:/WinAVR/avr/include/avr/eeprom.h ****  */
  44:C:/WinAVR/avr/include/avr/eeprom.h **** 
  45:C:/WinAVR/avr/include/avr/eeprom.h **** #ifndef _EEPROM_H_
  46:C:/WinAVR/avr/include/avr/eeprom.h **** #define _EEPROM_H_ 1
  47:C:/WinAVR/avr/include/avr/eeprom.h **** 
  48:C:/WinAVR/avr/include/avr/eeprom.h **** #define __need_size_t
  49:C:/WinAVR/avr/include/avr/eeprom.h **** #include <stddef.h>
  50:C:/WinAVR/avr/include/avr/eeprom.h **** #include <inttypes.h>
  51:C:/WinAVR/avr/include/avr/eeprom.h **** 
  52:C:/WinAVR/avr/include/avr/eeprom.h **** 
  53:C:/WinAVR/avr/include/avr/eeprom.h **** #ifdef __AVR_MEGA__
  54:C:/WinAVR/avr/include/avr/eeprom.h **** #define XCALL "call"
  55:C:/WinAVR/avr/include/avr/eeprom.h **** #else
  56:C:/WinAVR/avr/include/avr/eeprom.h **** #define XCALL "rcall"
  57:C:/WinAVR/avr/include/avr/eeprom.h **** #endif
  58:C:/WinAVR/avr/include/avr/eeprom.h **** 
  59:C:/WinAVR/avr/include/avr/eeprom.h **** #include <avr/io.h>
  60:C:/WinAVR/avr/include/avr/eeprom.h **** #ifndef __EEPROM_REG_LOCATIONS__
  61:C:/WinAVR/avr/include/avr/eeprom.h **** /** \def __EEPROM_REG_LOCATIONS__
  62:C:/WinAVR/avr/include/avr/eeprom.h ****     \ingroup avr_eeprom
  63:C:/WinAVR/avr/include/avr/eeprom.h ****      In order to be able to work without a requiring a multilib 
  64:C:/WinAVR/avr/include/avr/eeprom.h ****      approach for dealing with controllers having the EEPROM registers
  65:C:/WinAVR/avr/include/avr/eeprom.h ****      at different positions in memory space, the eeprom functions evaluate
  66:C:/WinAVR/avr/include/avr/eeprom.h ****      __EEPROM_REG_LOCATIONS__: It is assumed to be defined by
  67:C:/WinAVR/avr/include/avr/eeprom.h ****      the device io header and contains 6 uppercase hex digits encoding the 
  68:C:/WinAVR/avr/include/avr/eeprom.h ****      addresses of EECR,EEDR and EEAR. 
  69:C:/WinAVR/avr/include/avr/eeprom.h ****      First two letters:  EECR address.
  70:C:/WinAVR/avr/include/avr/eeprom.h ****      Second two letters: EEDR address.
  71:C:/WinAVR/avr/include/avr/eeprom.h ****      Last two letters:   EEAR address.
  72:C:/WinAVR/avr/include/avr/eeprom.h ****      The default 1C1D1E corresponds to the
  73:C:/WinAVR/avr/include/avr/eeprom.h ****      register location that is valid for most controllers. The value
  74:C:/WinAVR/avr/include/avr/eeprom.h ****      of this define symbol is used for appending it to the base name of the
  75:C:/WinAVR/avr/include/avr/eeprom.h ****      assembler functions.  */
  76:C:/WinAVR/avr/include/avr/eeprom.h **** #define __EEPROM_REG_LOCATIONS__ 1C1D1E
  77:C:/WinAVR/avr/include/avr/eeprom.h **** #endif
  78:C:/WinAVR/avr/include/avr/eeprom.h **** #define _STR2(EXP) _STR1(EXP)
  79:C:/WinAVR/avr/include/avr/eeprom.h **** #define _STR1(EXP) #EXP
  80:C:/WinAVR/avr/include/avr/eeprom.h **** #define _REG_LOCATION_SUFFIX _STR2(__EEPROM_REG_LOCATIONS__)
  81:C:/WinAVR/avr/include/avr/eeprom.h **** 
  82:C:/WinAVR/avr/include/avr/eeprom.h **** #ifndef CR_TAB
  83:C:/WinAVR/avr/include/avr/eeprom.h **** #define CR_TAB "\n\t"
  84:C:/WinAVR/avr/include/avr/eeprom.h **** #endif
  85:C:/WinAVR/avr/include/avr/eeprom.h **** 
  86:C:/WinAVR/avr/include/avr/eeprom.h **** 
  87:C:/WinAVR/avr/include/avr/eeprom.h **** /** \defgroup avr_eeprom <avr/eeprom.h>: EEPROM handling
  88:C:/WinAVR/avr/include/avr/eeprom.h ****     \code #include <avr/eeprom.h> \endcode
  89:C:/WinAVR/avr/include/avr/eeprom.h **** 
  90:C:/WinAVR/avr/include/avr/eeprom.h ****     This header file declares the interface to some simple library
  91:C:/WinAVR/avr/include/avr/eeprom.h ****     routines suitable for handling the data EEPROM contained in the
  92:C:/WinAVR/avr/include/avr/eeprom.h ****     AVR microcontrollers.  The implementation uses a simple polled
  93:C:/WinAVR/avr/include/avr/eeprom.h ****     mode interface.  Applications that require interrupt-controlled
  94:C:/WinAVR/avr/include/avr/eeprom.h ****     EEPROM access to ensure that no time will be wasted in spinloops
  95:C:/WinAVR/avr/include/avr/eeprom.h ****     will have to deploy their own implementation.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -