 |
 |
View previous topic :: View next topic |
Author |
Message |
dyeatman
Joined: 06 Sep 2003 Posts: 1950 Location: Norman, OK
|
|
Posted: Fri Nov 04, 2005 8:56 pm |
|
|
With arrays that size you are going to run into additional problems due to bank size (96) on the 16F series chips. You will either have to work around the bank size problem (there are lots of posts in this forum about the subject) or you might want to look at using the drop in replacement 18F series that eliminates the bank problem. |
|
 |
amcasi
Joined: 19 Jun 2015 Posts: 21 Location: Banned - Spammer
|
Good explanation |
Posted: Tue Oct 15, 2019 4:24 am |
|
|
Many many thanks to you for your good explanation. I could not find that explanation in the CCS_Manual.pdf. It must be there. I am looking here 2 times.
Thanks a lot
Huseyin
Anonymous wrote: | Code: |
#device *=16
#include<stdlib.h>
#FUSES XT, NOPROTECT, NOWDT, NOLVP, NOBROWNOUT
#use Delay(clock = 4000000)
#include "lcdDriver.c"
#include "codes.c"
void main()
{
int i;
for(i = 0; i < 30; i++)
{
printf(lcd_putch, "%d: %s\n", i, i < 16 ? codes0[i] : codes1[i - 16]);
delay_ms(1000);
}
}
|
codes.c contains two arrays of strings (codes0 and codes1).
I appreciate you taking the time to help. |
|
|
 |
Ttelmah
Joined: 11 Mar 2010 Posts: 19803
|
|
Posted: Tue Oct 15, 2019 9:40 am |
|
|
First comment. You can make your const arrays work, by adding the
instruction:
#device PASS_STRINGS=IN_RAM
Just after the processor include line.
Understanding this is a key feature of the PIC. Unlike 99% of other
processors, the PIC has the ROM as a completely separate memory space
to the RAM. So there are two address '0's, one in ROM and one in RAM.
A 'pointer', is inherently a RAM address, so const arrays won't work with
'pointers'.
The PASS_STRINGS option tells the compiler to create 'virtual' pointers
to strings stored as const's.
Then the ?: syntax, normally requires the test parameter to be in
brackets. Depending on the line being used, this is _required_ to make
the parsing work. Forcing this to be evaluated before the next statements.
((i < 16) ? codes0[i] : codes1[i - 16])
I'd probably also bracket the whole entity as well to ensure that the
printf sees it as a single value.
However 'PASS_STRINGS' requires a reasonably recent compiler. |
|
 |
|
|
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
|