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

Back to Subject List

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


 
Msg Score: -2
 -1 Answer is Wrong
 -1 Message Not Useful
#147078 - my explanation
Responding to: ???'s previous message

If you need to define a lot of values, use bits.
...
That just makes no sense at all!


I will explain my thinking by example:

Suppose you made a program that stores information about a user and what he is to a retail company.

Also, [u]assume[/u] that the program checks for the following conditions:

Did user pay on time?
Did user pay in full?
Does user exist?
Is the user an owner?
Is the user trustworthy?
Is user paying by cash?
Does user need to be audited?
Can user modify extra settings?

As you can see, each of these questions will likely produce two obvious answers. They are YES, and NO.

Some people might think that one byte of memory can store each answer. Yes, it is OK, but not practical. You should use one bit to store the answer of each question instead of one byte. Why?
because 1) it saves memory (you get 7 bits freed for each question like this), 2) an answer can only be one of two values. Since a bit can contain only two values (0, and 1), it would make sense to make YES = 1, and 0 = no.

So, in memory, if the answers to the questions above are yes, then you can store "11111111" in one byte of external memory.

If the last 3 questions had the answer NO, then you could store "11111000" in one byte of external memory.

storing "11111000" in one byte is better than storing:

00000001 00000001 00000001 00000001 00000001 00000000 00000000 00000000

in 8 bytes. Many would store each question in 1 byte, but you are wasting bits that way.

I am referring to external memory, not internal memory.

If I still confuse anyone, I will explain further.


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