打印
[AVR单片机]

简单的C语言语句

[复制链接]
3417|9
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
hufa123|  楼主 | 2010-11-30 15:34 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
ATMGE128手册中 关于EEPROM的读写操作中有段代码
void EEPRON_write(unsigned int uiaddress,unsigned int ucdata)
{
   /*等待上次写结束*/
   while(EECR&(1<<EEWE));
    /*设置地址和数据寄存器*/
   EEAR=uiaddress;
   EEDR=ucdata;
  /*置位EEMWE*/
EECR|=(1<<EEMWE);
  /*置位EEWE启动写操作*/
EECR|=(1<<EEWE);
}  
   中的1<<EEMWE 是怎么运算 能刚好把EECR中的 EEMWE 位置1?

相关帖子

沙发
472666GAQ| | 2010-11-30 15:42 | 只看该作者
EEWE 其实这个东西是代表一个数字的 你去GCC的文件看一下你就明白了~~

使用特权

评论回复
板凳
hufa123|  楼主 | 2010-11-30 16:19 | 只看该作者
GCC文件? 没找到。。

使用特权

评论回复
地板
472666GAQ| | 2010-11-30 18:40 | 只看该作者
用AVR Studio 4  不要直接用GCC   然后就能看见了

/* Copyright (c) 2004 Eric B. Weddington
   All rights reserved.

   Redistribution and use in source and binary forms, with or without
   modification, are permitted provided that the following conditions are met:

   * Redistributions of source code must retain the above copyright
     notice, this list of conditions and the following disclaimer.

   * Redistributions in binary form must reproduce the above copyright
     notice, this list of conditions and the following disclaimer in
     the documentation and/or other materials provided with the
     distribution.

   * Neither the name of the copyright holders nor the names of
     contributors may be used to endorse or promote products derived
     from this software without specific prior written permission.

  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  POSSIBILITY OF SUCH DAMAGE. */

/* $Id: iom16.h,v 1.14.2.6 2009/02/11 18:05:26 arcanum Exp $ */

/* avr/iom16.h - definitions for ATmega16 */

#ifndef _AVR_IOM16_H_
#define _AVR_IOM16_H_ 1

/* This file should only be included from <avr/io.h>, never directly. */

#ifndef _AVR_IO_H_
#  error "Include <avr/io.h> instead of this file."
#endif

#ifndef _AVR_IOXXX_H_
#  define _AVR_IOXXX_H_ "iom16.h"
#else
#  error "Attempt to include more than one <avr/ioXXX.h> file."
#endif

/* Registers and associated bit numbers */

#define TWBR    _SFR_IO8(0x00)

#define TWSR    _SFR_IO8(0x01)
#define TWPS0   0
#define TWPS1   1
#define TWS3    3
#define TWS4    4
#define TWS5    5
#define TWS6    6
#define TWS7    7

#define TWAR    _SFR_IO8(0x02)
#define TWGCE   0   
这是文件中的一部分

使用特权

评论回复
5
hufa123|  楼主 | 2010-11-30 21:38 | 只看该作者
原来是EEWE是一单纯的数字 不像PIC中每个位的代号啊:)

使用特权

评论回复
6
928315| | 2010-12-4 10:26 | 只看该作者
宏定义的数字啊。

使用特权

评论回复
7
windlrh| | 2010-12-5 18:07 | 只看该作者
谢谢,学习了。

使用特权

评论回复
8
windlrh| | 2010-12-5 18:07 | 只看该作者
帮楼主堆高房子

使用特权

评论回复
9
мe.蒾鋩| | 2010-12-7 10:26 | 只看该作者
:lol

使用特权

评论回复
10
老鱼探戈| | 2010-12-11 13:10 | 只看该作者
貌似已经解决了  :victory:

使用特权

评论回复
发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

186

主题

393

帖子

2

粉丝