搜索
bottom↓
回复: 3

codevisionavr中如何使用 "memcpy(testbuf,"DEBUGTEST-ON",12);

[复制链接]
头像被屏蔽

出0入0汤圆

发表于 2008-4-8 16:25:07 | 显示全部楼层 |阅读模式
提示: 作者被禁止或删除 内容自动屏蔽

阿莫论坛20周年了!感谢大家的支持与爱护!!

曾经有一段真挚的爱情摆在我的面前,我没有珍惜,现在想起来,还好我没有珍惜……
头像被屏蔽

出0入0汤圆

 楼主| 发表于 2008-4-8 16:40:49 | 显示全部楼层
提示: 作者被禁止或删除 内容自动屏蔽

出0入0汤圆

发表于 2008-4-8 20:59:16 | 显示全部楼层
memcpy只接受字节地址!
如果是公用体。请使用它的元素地址

testbuf{
  x
};
memcpy(&testbuf.x,"DEBUGTEST-ON",12);

2 使用memcpy(&testbuf.x,"DEBUGTEST-ON",12)不太好;因为“DEBUGTEST-ON"及占用FLSAH,又占用RAM。应为在编译时他属于常量。所以一直占用RAM。不合理。
建议定义为在FLASH中,再自写个小程序,从FLASH中读取到数组里面。

出0入0汤圆

发表于 2008-4-8 22:56:58 | 显示全部楼层
void *memcpy(void *dest,void *src, unsigned char n)

for the TINY memory model.

void *memcpy(void *dest,void *src, unsigned int n)

for the SMALL memory model.

Copies n bytes from src to dest. dest must not overlap src, else use memmove.

Returns a pointer to dest.

void *memcpyf(void *dest,void flash *src, unsigned char n)

for the TINY memory model.

void *memcpyf(void *dest,void flash *src, unsigned int n)

for the SMALL memory model.

Copies n bytes from src, located in FLASH, to dest. Returns a pointer to dest.

void *memccpy(void *dest,void *src, char c, unsigned char n)

for the TINY memory model.

void *memccpy(void *dest,void *src, char c, unsigned int n)

for the SMALL memory model.

Copies at most n bytes from src to dest, until the character c is copied.

dest must not overlap src.

Returns a NULL pointer if the last copied character was c or a pointer to dest+n+1.

void *memmove(void *dest,void *src, unsigned char n)

for the TINY memory model.

void *memmove(void *dest,void *src, unsigned int n)

for the SMALL memory model.

Copies n bytes from src to dest. dest may overlap src.

Returns a pointer to dest.

void *memchr(void *buf, unsigned char c, unsigned char n)

for the TINY memory model.

void *memchr(void *buf, unsigned char c, unsigned int n)

for the SMALL memory model.

Scans n bytes from buf for byte c.

Returns a pointer to c if found or a NULL pointer if not found.

signed char memcmp(void *buf1,void *buf2, unsigned char n)

for the TINY memory model.

signed char memcmp(void *buf1,void *buf2, unsigned int n)

for the SMALL memory model.

Compares at most n bytes of buf1 with buf2.

Returns <0, 0, >0 according to buf1<buf2, buf1=buf2, buf1>buf2.

signed char memcmpf(void *buf1,void flash *buf2, unsigned char n)

for the TINY memory model.


signed char memcmpf(void *buf1,void flash *buf2, unsigned int n)

for the SMALL memory model.

Compares at most n bytes of buf1, located in SRAM, with buf2, located in FLASH.

Returns <0, 0, >0 according to buf1<buf2, buf1=buf2, buf1>buf2.

void *memset(void *buf, unsigned char c, unsigned char n)

for the TINY memory model.

void *memset(void *buf, unsigned char c, unsigned int n)

for the SMALL memory model.

Sets n bytes from buf with byte c. Returns a pointer to buf.

===================================================================
以上是CVAVR的HELP中提供的函数,在里面找一下.
回帖提示: 反政府言论将被立即封锁ID 在按“提交”前,请自问一下:我这样表达会给举报吗,会给自己惹麻烦吗? 另外:尽量不要使用Mark、顶等没有意义的回复。不得大量使用大字体和彩色字。【本论坛不允许直接上传手机拍摄图片,浪费大家下载带宽和论坛服务器空间,请压缩后(图片小于1兆)才上传。压缩方法可以在微信里面发给自己(不要勾选“原图),然后下载,就能得到压缩后的图片。注意:要连续压缩2次才能满足要求!!】。另外,手机版只能上传图片,要上传附件需要切换到电脑版(不需要使用电脑,手机上切换到电脑版就行,页面底部)。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

手机版|Archiver|amobbs.com 阿莫电子技术论坛 ( 粤ICP备2022115958号, 版权所有:东莞阿莫电子贸易商行 创办于2004年 (公安交互式论坛备案:44190002001997 ) )

GMT+8, 2024-8-25 14:16

© Since 2004 www.amobbs.com, 原www.ourdev.cn, 原www.ouravr.com

快速回复 返回顶部 返回列表