3695|7

68

帖子

0

TA的资源

一粒金砂(初级)

楼主
 

关于C51内置EEPROM的问题 [复制链接]

现在需要用EEPROM保存一些参数,程序用KEIL C写的,现在就不知道参数该怎么保存,直接赋值?还是需要其他什么操作
直接赋值的话:
....
int xdata canshu;
.....
canshu=122;
....

但有个EECON寄存器,不知道需不需要对这个寄存器进行操作?

50分口牙

最新回复

LZ,你那基本是对的 但是,你看看上面那个读写流程 使能EEPROM 注意,标志判断等。。。 就OK了 。。。。。。。。。。 呵呵 http://www.waveshare.net/Datasheet_PDF/ATMEL_PDF/AT89C51RD2-ED2.PDF 这个是PDF的地址   详情 回复 发表于 2008-11-15 11:59
点赞 关注

回复
举报

76

帖子

0

TA的资源

一粒金砂(初级)

沙发
 
xdata是读写外部RAM的,可能要通过寄存器写入和读出吧,参考datasheet.
 
 

回复

77

帖子

0

TA的资源

一粒金砂(初级)

板凳
 
宏晶网站主页上有个例子,好用的,你看能不能用的上~~~
 
 
 

回复

82

帖子

0

TA的资源

一粒金砂(初级)

4
 
一般对EEprom 都需要设置它的寄存器的。最好看下它的datasheet
 
 
 

回复

62

帖子

0

TA的资源

一粒金砂(初级)

5
 
天知道你用什么片子

呵呵

来大家一起算命

呵呵
 
 
 

回复

68

帖子

0

TA的资源

一粒金砂(初级)

6
 
at89c51ed2
 
 
 

回复

85

帖子

0

TA的资源

一粒金砂(初级)

7
 
23. EEPROM Data Memory
This feature is available only for the AT89C51ED2 device.
The 2K bytes on-chip EEPROM memory block is located at addresses 0000h to 07FFh of the
XRAM/ERAM memory space and is selected by setting control bits in the EECON register.
A read or write access to the EEPROM memory is done with a MOVX instruction.

23.1 Write Data
Data is written by byte to the EEPROM memory block as for an external RAM memory.
The following procedure is used to write to the EEPROM memory:
? Check EEBUSY flag
? If the user application interrupts routines use XRAM memory space: Save and disable
interrupts.
? Load DPTR with the address to write
? Store A register with the data to be written
? Set bit EEE of EECON register
? Execute a MOVX @DPTR, A
? Clear bit EEE of EECON register
? Restore interrupts.
? EEBUSY flag in EECON is then set by hardware to indicate that programming is in progress
and that the EEPROM segment is not available for reading or writing.
? The end of programming is indicated by a hardware clear of the EEBUSY flag.

23.2 Read Data
The following procedure is used to read the data stored in the EEPROM memory:
? Check EEBUSY flag
? If the user application interrupts routines use XRAM memory space: Save and disable
interrupts.
? Load DPTR with the address to read
? Set bit EEE of EECON register
? Execute a MOVX A, @DPTR
? Clear bit EEE of EECON register
? Restore interrupts.

 
 
 

回复

77

帖子

0

TA的资源

五彩晶圆(中级)

8
 
LZ,你那基本是对的

但是,你看看上面那个读写流程

使能EEPROM

注意,标志判断等。。。

就OK了

。。。。。。。。。。

呵呵
http://www.waveshare.net/Datasheet_PDF/ATMEL_PDF/AT89C51RD2-ED2.PDF

这个是PDF的地址

 
 
 

回复
您需要登录后才可以回帖 登录 | 注册

随便看看
查找数据手册?

EEWorld Datasheet 技术支持

相关文章 更多>>
关闭
站长推荐上一条 1/6 下一条

 
EEWorld订阅号

 
EEWorld服务号

 
汽车开发圈

About Us 关于我们 客户服务 联系方式 器件索引 网站地图 最新更新 手机版

站点相关: 国产芯 安防电子 汽车电子 手机便携 工业控制 家用电子 医疗电子 测试测量 网络通信 物联网

北京市海淀区中关村大街18号B座15层1530室 电话:(010)82350740 邮编:100190

电子工程世界版权所有 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号 Copyright © 2005-2025 EEWORLD.com.cn, Inc. All rights reserved
快速回复 返回顶部 返回列表