> > Hello all, > I have a question. I have a bunch of data that is 14 bits in size. I'm > using Hitech PIC-C so I've placed the data in an integer. I've done > something like this: > > const int data[256] = {0x2324,0x2425,0x3233, ..... }; > > So I compile and I notice that in the program memory ROM the data is > stored like this: > > 3F24 3F23 3F25 3F24 .... > > Look at all that space that could be used. My 256 array takes up 512 > words of program memory. Now my data is only 14 bits big. Is there > anyway I can delcare a variable 14 bits in size such that my constant > table of data that is 256 14bit words big could be stored in 256 words of > program memory? Nope. This is the standard. Each one of these is an actual instruction. A RETLW with the 8 bit value to return. > > Same goes for charaters. If I never plan to use characters with an ASCII > value greater than 127, then can I find some efficent way to store these > 7bit characters in program memory without using 1 word per character. Ie > stick two 7bit characters in 1 word of program memory. > > Note: I don't want to use the write to and read from program memory > capabilities of the PIC16F877 because that would just cause more code to > be writen and hence more program memory occupied. Soemthing like the > const expression which stores values in ROM is what I'm looking for. Well you can't really have it both ways. You can do it if you at least read the program memory, if not write it. But if you plan to use the existing mechanism, then you're stuck. BTW if you do implement read/write of program memory, then the program cannot be transferred to anything other than other 16C87X family members. This is the price of a harvard architecture machine. Data isn't really designed to be stored in the program memory space. BAJ