|
|
View previous topic :: View next topic |
Author |
Message |
Lehhu Guest
|
To many variable? PIC18f452/458. |
Posted: Sat Feb 25, 2006 6:13 am |
|
|
I've a problem with a big program, so a write small program for a test.
My program:
VOID main(){
WHILE ( 1 ) {
output_high ( pin_A0 );
delay_ms ( 1000 );
output_low ( pin_A0 );
delay_ms ( 1000 );
}
}
At the beginning of this program I�ve many variable. If variables takes less then 96 bytes it works ok, and part of .lst file looks like:
RAM used: 95 (6%) at main() level
96 (6%) worst case
.............................
00F8: CLRF 06
00FA: CLRF 08
00FC: CLRF 09
00FE: CLRF 0A
0100: CLRF 0B
0102: CLRF 0C
But if I add only one variable program don�t works correctly and part of .lst file looks like:
RAM used: 96 (6%) at main() level
97 (6%) worst case
......................................
0034: CLRF x60
0036: CLRF x61
0038: CLRF x62
003A: CLRF x63
No ERRORs and no wornings from compiler.
What does the �x� means, and why the program don�t work correctly when I�ve more then 96 bytes takes for variables?
I�m using: PCH 3.242
PIC18f452/458
Any ideas?
P.S. Sorry for my english |
|
|
Ttelmah Guest
|
|
Posted: Sat Feb 25, 2006 9:09 am |
|
|
The 'x', means this is using bank addressing. There will be a line just in front of this block, setting the bank value to be used.
This is normal.
Below 96 bytes, everthing fits into the bottom bank, so this does not happen.
Your 'test'program should work right in either case, but you don't show enough to know for sure. What are the fuses set to?. Show the variable declarations.
There are some memory allocation oddities that have appeared with the latest compilers. These are tied up with these really being in part 'betas' for the forthcoming linker. What happens with 3.229?. 3.243, fixes some of these problems. Generally, the problems don't seem to appear if you stick to simple variable declarations. Unless you need the new features offered by the 'latest' compiler, you will be safer using the earlier posted version(s), especially when there are major changes happening.
Best Wishes |
|
|
Guest
|
|
Posted: Mon Feb 27, 2006 3:55 am |
|
|
After Your answer Ttelmah I've start searching something about bank adressing,and I found:
A new #TYPE option has been added to allow the default address space for
a block of code to be specified. For example to allocate a block of variables
to the memory area 0x100 to 0x1FF do this:
typemod <,,,0x100,0x1ff> user_ram_block;
#type default=user_ram_block
... all variable declarations in this area
... will be in 0x100-0x1FF
#type default=
... memory allocation back to normal
When I apply this the program start works correctly.
THX |
|
|
ckielstra
Joined: 18 Mar 2004 Posts: 3680 Location: The Netherlands
|
|
Posted: Mon Feb 27, 2006 4:08 am |
|
|
Quote: | #type default=
... memory allocation back to normal
When I apply this the program start works correctly. | Sounds to me like you are using one of the latest compiler releases like v3.240 or 3.242 which were buggy. Please note that the most recent releases are always considered Beta versions by CCS, don't use these unless you need the new features. On the CCS download page you will also find an older version which is considered to be stable, currently v3.236. |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|