搜索
bottom↓
回复: 2

cvavr中RAM下的Data Stack size是指什么,还没查出来

[复制链接]

出0入0汤圆

发表于 2012-1-24 18:26:38 | 显示全部楼层 |阅读模式
马老师书的例子好像都是256吧,这个值应该设为多少好呢?根据什么原则呢?
还有个问题,我用cvavr不能go to definition/declaration啊,到现在还没查到delay_ms()函数在哪儿申明的。。。唉。。。

(原文件名:1.jpg)
它这里go to definition/declaration这个选项卡都已经激活了的啊,那说明应该可以定位的嘛

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

月入3000的是反美的。收入3万是亲美的。收入30万是移民美国的。收入300万是取得绿卡后回国,教唆那些3000来反美的!

出0入0汤圆

发表于 2012-2-16 20:32:56 | 显示全部楼层
看CVAVR的HELP,不过你必须具备更多的基础,否则看不懂的。

简单贴上一点载录:

关于Data Stack

The Data Stack area is used to dynamically store local variables, passing function parameters and saving registers during interrupt routine servicing:
·      standard core: R0, R1, R15, R22, R23, R24, R25, R26, R27, R30, R31 and  SREG
·      reduced core: R16, R17, R22, R23, R24, R25, R26, R27, R30, R31 and SREG.


The Data Stack Pointer is implemented using the Y register.
At start-up the Data Stack Pointer is initialized with the value 5Fh (or FFh for some chips)+Data Stack Size.
When saving a value in the Data Stack, the Data Stack Pointer is decremented.
When the value is retrieved, the Data Stack Pointer is incremented back.
When configuring the compiler, in the Project|Configure|C Compiler|Code Generation menu, you must specify a sufficient Data Stack Size, so it will not overlap the I/O Register area during program execution.

要自己定义它的值的话,是高手做的事情

关于delay函数

These functions are intended for generating delays in C programs.
The prototypes for these functions are placed in the file delay.h, located in the .\INC subdirectory. This file must be #include -d before using the functions.
Before calling the functions the interrupts must be disabled, otherwise the delays will be much longer then expected.
Also it is very important to specify the correct AVR chip Clock frequency in the Project|Configure|C Compiler|Code Generation menu.


The functions are:


void delay_us(unsigned int n)


      generates a delay of n mseconds. n must be a constant expression.


void delay_ms(unsigned int n)


      generates a delay of n milliseconds.
This function automatically resets the wtachdog timer every 1ms by generating the wdr instruction.


1.这两个函数是CVAVR提供的内部函数,在CVAVR中没有C的原代码,只提供二进制的执行代码库。你一旦调用,连接时会加入到你的执行代码中的。

2.这个delay是采用软件延时的。

3.如果要看代码,可以看编译连接后的反汇编代码,看到的是汇编代码(一个子程序调用)

4.go to definition/declaration是看你自己的定义声明,两个函数系统的定义声明在DELAY.H中,它在CVAVR系统的\INC下面。你#include就是表示声明了,但go to definition/declaration是不看的

5.DELAY.h 的声明如下,就是几行:
// CodeVisionAVR C Compiler
// (C) 1998-2000 Pavel Haiduc, HP InfoTech S.R.L.

#ifndef _DELAY_INCLUDED_
#define _DELAY_INCLUDED_

#pragma used+

void delay_us(unsigned int n);
void delay_ms(unsigned int n);

#pragma used-

#endif

出0入0汤圆

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

本版积分规则

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

GMT+8, 2024-4-25 23:27

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

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