Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
12/29/04 21:53
Read: times


 
#84071 - the space is the place ...
Responding to: ???'s previous message
Neil Kurzman said:

put
Byte TEST[] = { (Byte)0x01, (Byte)0x02, (Byte)0x03 };
in a C module.

Then put
extern Byte TEST[];
in the header file.


..just make sure you don't include that header in the same file where you define the array. Otherwise you'll get compiler complaints about duplicate definitions or some such. I've seen code that uses #ifdefs and #undefs and such as hacks around this.

You might want to specify what space the array lives in. I think th straight instantiation will put the array on the heap, which (again I think) ends up in the internal RAM. That memory is obviously limited, so if you do:
byte xdata TEST[] = { (byte) 0x01 ... };
the compiler will put the array into the external data memory, if your hardware supports this. (Dunno what'll happen if you don't have hardware support for xdata.)

(Guess who was just bitten by this????)

Also, if the array is meant to be constant, save some more space by putting it into code space:
byte code TEST[] { (byte) 0x01, ...};
This all assumes the Keil tools.

--a

List of 14 messages in thread
TopicAuthorDate
How to #define an array            01/01/70 00:00      
   not an array            01/01/70 00:00      
   if you really mean an array            01/01/70 00:00      
      Let me clarify myself a bit            01/01/70 00:00      
         extern            01/01/70 00:00      
            thanks            01/01/70 00:00      
            the space is the place ...            01/01/70 00:00      
               Answer is wrong - in part            01/01/70 00:00      
                  you're correct, of course!            01/01/70 00:00      
               memory spaces            01/01/70 00:00      
            Almost but not quite.            01/01/70 00:00      
               being sure            01/01/70 00:00      
                  oh..            01/01/70 00:00      
   Back to basics            01/01/70 00:00      

Back to Subject List