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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
08/31/06 22:31
Read: times


 
#123473 - Have you tried a simulator?
Responding to: ???'s previous message
At a glance, I can't see anything obvious (to me at least). It might come down to the declaration of the various types you are using. You haven't showed us the whole picture! you should have Checksum declared as an unsigned char as well as the other vars you are xoring with.

I would suggest using a simulator to step through the code and give you an idea of what is happening. You can stare at a piece of code all day and not find the solution or run through a simulator and find it in minutes.

p.s There might be valid reason to have you code inline like it is, but normally one would separate the code out into a couple of loops - the first to calc the checksum, the second to send it or simply one loop to calc the checksum and send. At least then there's only one instance of the xor. Also read up on structures - using these will make your code a bit neater and easier to read/maintain.



List of 24 messages in thread
TopicAuthorDate
^= , Checksum, Problem            01/01/70 00:00      
   Have you tried a simulator?            01/01/70 00:00      
      well,            01/01/70 00:00      
      OK            01/01/70 00:00      
   volatile?            01/01/70 00:00      
      volatile            01/01/70 00:00      
         using ICE ?            01/01/70 00:00      
            update code (working) and clarification            01/01/70 00:00      
               Style            01/01/70 00:00      
               Think about your variable types            01/01/70 00:00      
                  Thanks            01/01/70 00:00      
                     Magic numbers            01/01/70 00:00      
                        but don't be "oversmart"            01/01/70 00:00      
                           example?            01/01/70 00:00      
                           advantages            01/01/70 00:00      
                              the most often forgotten quality guarantee            01/01/70 00:00      
                     so, use structures!            01/01/70 00:00      
                        padding            01/01/70 00:00      
                   and             01/01/70 00:00      
                     Actual Output            01/01/70 00:00      
                     C99            01/01/70 00:00      
                        making up your own            01/01/70 00:00      
                           Names            01/01/70 00:00      
                     FYI - C99 Exact- & Minimum-width types            01/01/70 00:00      

Back to Subject List