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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
11/15/07 15:46
Read: times


 
Msg Score: -3
 -2 Answer is Wrong
 -1 Message Not Useful
#147020 - comments
Responding to: ???'s previous message
Andy Neil said:
The bootloader simply loads the image into memory - then runs it;

not quite.

a bootloader (in similest terms) is a piece of software that runs first before any OS starts. An example is LILO for Linux.

Andy, do you mean "the computer" instead of "Bootloader"?

see: http://en.wikipedia.org/wiki/Booting


When we use xdata its also used to access the expanded RAM ( the ram beyond the internal 256 bytes mark) in 8051 as well as giving access to expanded RAM in my opinion ????
...
because the xdata was in use even before i incorporated the external RAM...


Remeber that x means external. so xdata = external data.
If you want to dig deeper, you might want to use a program called asem-51 (found at http://plit.de/asem-51/). It is an 8051 assembler.

Make an assembly script file, and use the MOVX instruction to access your expanded ram.

You also might want to look at the SBC (single-board computer) found here, and at PJRC's web site (I think pjrc.com). The 8051 chip has a multiplexed address and data line. a latch is used to separate the lines so that we can get 8 data lines and 16 address lines. The address lines are very important because they can indicate which addresses are valid for MOVX.

For example, if you had an 8-byte ram chip, you will have 8 data lines, and 3 address lines. Why 3 address lines? because 2 ^ 3 = 8. If you hooked up the address lines to A0, A1, and A2 (coming from the external latch connected to the 8051), then issuing MOVX to addresses ending in any of these binary values: 000,001,010,011,100,101,110,111 will be valid and will modify your memory.
This means that address #8 and address #0 will point to the exact same memory location. why? because the the first 3 bits are only used, and the 4th bit is undefined. Given the fact that the #8 is 1000 binary, we drop everything past the 3rd bit, and we get 000 binary which is one of the values I mentioned above.

So your best bet is to fill up the addresses in order so you don't have to use complicated math. If you are using 32K (Kilobytes) of ram, your best bet is to connect A0 to A14 to the RAM and leave A15 floating for now. that way, any addresses between 0 and 32K will be unique. If you stayed with this suggestion, then you will notice that 32K - 64K mirrors 0 to 32K of ram. In other words, byte 0 is byte 32K.

Arranging your hardware is very important, because your software will work with your hardware.


now i have run out of memory for defining new varaibles...

Think about your variables.

If you are using strings, memory will be used very quickly.
If you need to define alot of values, use bits.
There are 8 bits in a byte. So if you had many binary states (I like to call them flags) to compare, definitely use bits.

You might have to add extra code to compare bits, but memory wise, it is well worth it.

If that doesn't work, you could try to compress your variables.
By that, I mean make a smaller representation of a large value.

For example, if you declared a string in a slot of memory, and your sting was equal to lets say:

AAAABBBBCCCCDDDDEEEEFFFF

you will be using 24 bytes of memory.

The easiest way to compress it, but not the absolute best is to make the output like this:

4A4B4C4D4E4F

All I did there was count each letter, and prefix it with the number of that letter.

That takes 12 bytes of memory, a nice reduction.

But if you really got desperate, and conditions permit, you could increase the math.

What if we were to convert the values.

Let's define the maximum number of repeated characters we will allow. Let's say 8.

this means that our value must be <= 1000 binary.

So we can write:

4A4B4C4D4E4F

as (in bits):

0100 01000001 0100 01000010 0100 01000011 0100 01000100
0100 01000101 0100 01000110

Adding all this up, we get a total of 72 bits, which equals to 9 bytes. We saved 3 bytes!

I can't go on forever, but you now get the idea that good compression and good logic can make 32KB of memory an extremely large amount of space to play with.

List of 119 messages in thread
TopicAuthorDate
USING EXTERNAL RAM AS CODE MEMORY            01/01/70 00:00      
   no need            01/01/70 00:00      
      MMC ...            01/01/70 00:00      
         Let him do what he wants!            01/01/70 00:00      
            did I say not to?            01/01/70 00:00      
            how to?            01/01/70 00:00      
               But how?            01/01/70 00:00      
                  well,            01/01/70 00:00      
                     end of wrong stick!            01/01/70 00:00      
                        already stated            01/01/70 00:00      
                           I see            01/01/70 00:00      
   How will you load the RAM?            01/01/70 00:00      
   I agree with some here            01/01/70 00:00      
      What's pretty handy is BBRAM            01/01/70 00:00      
         True, but            01/01/70 00:00      
      double-post ... sorry!            01/01/70 00:00      
      A little tidy-up            01/01/70 00:00      
         there is a way ... in fact, several ...            01/01/70 00:00      
            and appears to have lost interest            01/01/70 00:00      
               APOLOGIES AND CLARIFICATION            01/01/70 00:00      
                  answer            01/01/70 00:00      
                     Why 32K?            01/01/70 00:00      
                        Erik's Answer            01/01/70 00:00      
                     FURTHER HELP NEEDED.            01/01/70 00:00      
                        Yes, of course!            01/01/70 00:00      
                           the Basics implementation            01/01/70 00:00      
                              TC?            01/01/70 00:00      
                              Please explain            01/01/70 00:00      
                                 Binary executable format?            01/01/70 00:00      
                                    Still not got it!            01/01/70 00:00      
                                       order of intel hex file            01/01/70 00:00      
                                          records in Intel Hex file not necessarily in order            01/01/70 00:00      
                                             YES THE RECORDS ARE NOT IN SEQUENCE            01/01/70 00:00      
                                                Not strange at all            01/01/70 00:00      
                                 Good question...            01/01/70 00:00      
                                    Binary executable            01/01/70 00:00      
                                       I don't think you were            01/01/70 00:00      
                                          Elaboration requested.            01/01/70 00:00      
                                             GOT it, no elaboration required            01/01/70 00:00      
                                             That's it            01/01/70 00:00      
                        I'm sorry, but            01/01/70 00:00      
                        .            01/01/70 00:00      
                           here is a link to a free 8051 assembler.            01/01/70 00:00      
                           Pardon?            01/01/70 00:00      
                              I didnt mean it that way.            01/01/70 00:00      
                                 Still lost            01/01/70 00:00      
                                    I HAVE TO DEAL WITH HEX CODE            01/01/70 00:00      
                                       Additionaly            01/01/70 00:00      
                                          Duplicate post!            01/01/70 00:00      
                  Some comments            01/01/70 00:00      
         I'm using simple terms            01/01/70 00:00      
            @ Mike Stegaier            01/01/70 00:00      
            Not true            01/01/70 00:00      
               FLASH ROM and EEPROM            01/01/70 00:00      
                  Literal or idiomatic            01/01/70 00:00      
                     here's why            01/01/70 00:00      
                        .            01/01/70 00:00      
                           oh yes, it is            01/01/70 00:00      
                              ...            01/01/70 00:00      
   double post, please ignore            01/01/70 00:00      
   KISS            01/01/70 00:00      
   Similar project            01/01/70 00:00      
   Additionaly            01/01/70 00:00      
      You really need to study some basics first!            01/01/70 00:00      
         Apology            01/01/70 00:00      
      Make it simple...            01/01/70 00:00      
   Dynamic linking            01/01/70 00:00      
      Not on an 8051!            01/01/70 00:00      
         But i have to find a way            01/01/70 00:00      
            Bootloader            01/01/70 00:00      
            tri-processor?            01/01/70 00:00      
            You are where you are            01/01/70 00:00      
               Brand new product            01/01/70 00:00      
         There may be a way out after all ...            01/01/70 00:00      
            I don't think so?            01/01/70 00:00      
   Processor Not my choice            01/01/70 00:00      
   How to use external EEPROM AT24C16A with P89C51RD2            01/01/70 00:00      
   ANDY is right jerson but Thanks :)            01/01/70 00:00      
      Thinking laterally            01/01/70 00:00      
         good idea!            01/01/70 00:00      
            Some sort of P-Code Interpreter            01/01/70 00:00      
   Comments            01/01/70 00:00      
      Really Bad idea!            01/01/70 00:00      
         Misunderstanding            01/01/70 00:00      
            why, oh why?            01/01/70 00:00      
            No - that is still a really bad idea!            01/01/70 00:00      
               Is it Still a bad idea????????            01/01/70 00:00      
                  Use the Linker            01/01/70 00:00      
                     Got it Andy.            01/01/70 00:00      
      Summary needed            01/01/70 00:00      
         Required Summary            01/01/70 00:00      
            somethingt does not jive            01/01/70 00:00      
            something else does not jive            01/01/70 00:00      
               Yes i have 3 processors            01/01/70 00:00      
            Why only 32K            01/01/70 00:00      
               32k is fine but do suggest some IC's            01/01/70 00:00      
                  -2 for help?            01/01/70 00:00      
                     Still don't get it!            01/01/70 00:00      
                  don't be silly            01/01/70 00:00      
                     Thanks ERIC!!!!            01/01/70 00:00      
      comments            01/01/70 00:00      
         What a revelation, I bet most did not know that            01/01/70 00:00      
         ???            01/01/70 00:00      
            THANKS ANDY, you are a real CHUM            01/01/70 00:00      
            my explanation            01/01/70 00:00      
               who on earth, in his right mind ...            01/01/70 00:00      
               You need to think more carefully before you write            01/01/70 00:00      
         Data compression, point taken            01/01/70 00:00      
   CHECKSUM COMPLETED            01/01/70 00:00      
      Time for a new thread?            01/01/70 00:00      
   CONTROLLER SPEEDS/ MISMATCH CRYSTAL??????            01/01/70 00:00      
      Don't ignore the datasheet!            01/01/70 00:00      
         Through a pin/bit complementing program            01/01/70 00:00      
            who gives a hoot            01/01/70 00:00      
            Obviously will be less than the crystal frequency!            01/01/70 00:00      
               Only Complement instruction            01/01/70 00:00      
                  Complement Only?            01/01/70 00:00      
                     Can't be just a single instruction!            01/01/70 00:00      
                        GOT THE POINT.            01/01/70 00:00      

Back to Subject List