simulator 发表于 2007-11-28 09:30:01

请教一下bascom初始化的问题

$hwstack
$swstack
$framesize是什么意思?
大小根据什么定?怎么设置?

meitun 发表于 2007-11-28 10:14:56

设置堆栈什么的。
对于初学者,使用默认的,一般〔99%〕情况都不会出错。
如果中断,串口,子程序使用的很多,可以设置的大一点。

machao 发表于 2007-11-28 17:09:41

先按1楼的做.在BASCOM-AVR的帮助中,有具体的说明和计算方法,写比较大和复杂的程序时,可以参考.

simulator 发表于 2007-11-28 18:41:44

谢谢meitun,谢谢马老师.
一楼给了只鱼.
二楼给了只"渔"

machao 发表于 2007-11-28 22:18:08

Options Compiler Chip

Chip Selects the target chip. Each chip has a corresponding x.DAT file with specifications of the chip. Note that some DAT files are not available yet.

XRAM Selects the size of the external RAM. KB means Kilo Bytes. For 32 KB you need a 62256 STATIC RAM chip.

HW Stack The amount of bytes available for the hardware stack. When you use GOSUB or CALL, you are using 2 bytes of HW stack space. When you nest 2 GOSUB’s you are using 4 bytes (2*2). Most statements need HW stack too. An interrupt needs 32 bytes.

Soft Stack Specifies the size of the software stack. Each local variable uses 2 bytes. Each variable that is passed to a
sub program uses 2 bytes too. So when you have used 10 locals in a SUB and the SUB passes 3 parameters, you need 13 * 2 = 26 bytes.

Frame size Specifies the size of the frame. Each local variable is stored in a space that is named the frame space. When you have 2 local integers and a string with a length of 10, you need a frame size of (2*2) + 11 = 15 bytes.
The internal conversion routines used when you use INPUT num, or STR(), or VAL(), etc, also use the frame. They need a maximum of 16 bytes. So for this example 15+16 = 31 would be a good value.

XRAM wait state Select to insert a wait state for the external RAM.

External Access enable. Select this option to allow external access of the micro. The 8515 for example can use port A and C to control a RAM chip. This is almost always selected if XRAM is used

Default Press or click this button to use the current Compiler Chip settings as default for all new projects.

simulator 发表于 2007-11-28 23:12:08

谢谢马老师,现在搞清楚了.GOSUB,CALL要两个字节的HW STACK;每个局部变量使用两个字节的SW STACK; 转换子程序INPUT num, or STR(), 或 VAL(),决定使用的framesize.

favr 发表于 2007-11-28 23:38:42

最好看看帮助文件中硬件部分的内存使用一节,里面讲得很清楚。
我一般在写程序时有不明白的首先想到的是手册(帮助文档),如果找不到相关解决方法,就自己写一些短的测试代码,专门测试需要的功能,确实不行Google看看,再不行就发问。
页: [1]
查看完整版本: 请教一下bascom初始化的问题