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

Back to Subject List

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


 
Msg Score: +3
 +3 Good Answer/Helpful
#110459 - Guru 'magic'
Responding to: ???'s previous message
Sushil, as the others have complained about your code being unreadable, I thought I'd add a little more.

Firstly, as the others have said, is posting the code to preserve the format.

Secondly - surely your assembler has deinitions for the SFRs of at least the 8051. setb 93h might mean something to you, but to most of us we would have to look up what SFR is at address 93. Even if your assembler doesn't have the definitions even for your RD2 processor, you should take the time to write it yourself. It will save you much time in the long run and avoid many errors. Make the assembler work for you!

Next is the use of memory. Again, make the assembler work for you - don't do things like mov a,30h - what does that mean? Something like mov a,crc_low gives us a better idea of what that memory location is supposed to represent.


mov sp,#stack
...
...
org 30h
crc_low ds 1
crc_high ds 1
stack equ *

will always ensure your stack is above your variables as well as having the assembler calculate the memory addresses for you. If you are not sure how to do this, tell us what assembler you are using and I'm sure someone here will help.

It seems that by posting code that us gurus will use our magic to decipher what the problem is. Unfortunately, due to the poor layout of the code, we would have to spend a lot of time rewriting the code so it makes rational sense to us. Then we can try to interpret what the code is expected to do. For myself, there is no magic involved and I'm not possessed of superhuman intellect - the secret is to make your code simple and readable. You will find by doing a few simple things will make it easier to write the code, debug the code and understand the code when you have to change it 6 months later.

Also, how can you be sure the problem is with the code? The dataflash is 3v only (I could be wrong here..) - does this mean your cpu runs on 3V also?






List of 21 messages in thread
TopicAuthorDate
DataFlash            01/01/70 00:00      
   user_count++            01/01/70 00:00      
   What's in a name?            01/01/70 00:00      
      how you trying to read an write on flash            01/01/70 00:00      
         Not just any old flash            01/01/70 00:00      
   DataFlash using SPI of 89V51RD2            01/01/70 00:00      
      use CodeArchitect            01/01/70 00:00      
         How to post code and retain format            01/01/70 00:00      
      Guru 'magic'            01/01/70 00:00      
         be egotistical            01/01/70 00:00      
            It's worse than that, Jim!            01/01/70 00:00      
               yes, i remember from my time in Britain            01/01/70 00:00      
         But wait.. there's more!            01/01/70 00:00      
            It can't            01/01/70 00:00      
   More magic            01/01/70 00:00      
      AVR BUTTERFLY            01/01/70 00:00      
   thanks for the valuable suggestions            01/01/70 00:00      
      Latch?            01/01/70 00:00      
      Atmel Application Note            01/01/70 00:00      
   Re:Atmel Application Note            01/01/70 00:00      
      But why a Latch            01/01/70 00:00      

Back to Subject List