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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
04/13/11 17:33
Read: times


 
#181867 - No. You think you have tested but not multiple turns
Responding to: ???'s previous message
Vaggelis Triantafillou said:
Per Westermark said:
Another thing - what happens if you only get 24 bytes and then a pause? What do you do? Wait for next transmission of 25 characters to eat the first character?

This is fix, I must take 25 bytes, there is no way to take more bytes. If I take less bytes there is a problem that I must see it.

Standard error handling demands that code must be adaptible. What if you get a transfer error resulting in your code getting only 24 characters, or getting just a single character? Even if a valid message must be 25 characters, you can't demand 25 bytes from the UART. Any communication code must be prepared for the situations that you get too little or too much and resynchronize someway. What happens if your PC waits for a TCP/IP message on the network cable before you are allowed to shut it down, and that specific message never comes? Should you never be allowed to turn off the PC then?

Vaggelis Triantafillou said:
Per Westermark said:
Next - your code can't work because you haven't even used pen and paper and tried it out.

You think so ??

Yes.

Vaggelis Triantafillou said:
Per Westermark said:
You have a loop that you intend to run for 25 turns. So why do you load DPTR with 0xfe00 each time and use this address for storage and then increment DPTR? What happens with your increment when you once more loads DPTR with the original value again?


Yes, is not happen what I would like. I thought it would increase the adrress at a time.

It does. But since you reset DPTR to the initial value every turn of the loop, your increment will be overwritten. Single-stepping the loop on paper should have shown you this. If your goal is to increment DTPR inside a loop then DPTR must be given its initial value before you enter the loop. Having both initial value and increment inside the same loop will just have the two instructions fight each other.

When you get experienced, you can "test" code in your head because you get better and better at visualizing what happens - how many source lines and variable operations interacts. But it really is good to test something with pen andnd paper and to write down the values of the variables as you step through the instructions. But when you have a loop, you must step through that loop multiple times to see that the loop continues to progress towards the goal. Your 25 iteration steps should be ticked off one-by-one. And your destination address should also be ticking step-by-step. Pen and paper would tell you if two processor instructions fights each other.

List of 77 messages in thread
TopicAuthorDate
Intel 8051 RS-232 Interface and fingerprint module !!            01/01/70 00:00      
   I want to see the packet            01/01/70 00:00      
   Comments            01/01/70 00:00      
      MTS-51 8051 Microcomputer Trainer            01/01/70 00:00      
         A what?            01/01/70 00:00      
            please help !!            01/01/70 00:00      
               Never wait until "it works"            01/01/70 00:00      
                  I do it            01/01/70 00:00      
                     RE: "must work to continue writing code"            01/01/70 00:00      
                     you got a very positive reply            01/01/70 00:00      
               You need to provide the information!            01/01/70 00:00      
               P2            01/01/70 00:00      
   that old?            01/01/70 00:00      
      No - not that old!            01/01/70 00:00      
         80C51RD+            01/01/70 00:00      
            But what about those displays??            01/01/70 00:00      
               7-Segment LED displays            01/01/70 00:00      
                  That raises further questions            01/01/70 00:00      
                     BCD to 7-segment decoder            01/01/70 00:00      
                        But still no answer - repeated identical values?            01/01/70 00:00      
                           DELAY            01/01/70 00:00      
                              And you're surprised that you miss characters?!            01/01/70 00:00      
                                 Yes you are right but            01/01/70 00:00      
                                    Think about it            01/01/70 00:00      
                                       too busy to think ?            01/01/70 00:00      
                                          Coding is the LAST thing you should do!            01/01/70 00:00      
   Interesting article about fingerprint recognition            01/01/70 00:00      
      Thank you very much            01/01/70 00:00      
         Nothing to do with nitgen            01/01/70 00:00      
            yes I have read...            01/01/70 00:00      
               Again,            01/01/70 00:00      
                  ok, I am listenig to you..            01/01/70 00:00      
                     Serial Comms            01/01/70 00:00      
                        Σας ευχαριστώ κύριε Αγγελή για την            01/01/70 00:00      
                           BEFORE you start coding...            01/01/70 00:00      
                           Thinking before coding            01/01/70 00:00      
   Thank you very much..            01/01/70 00:00      
      Standard byte-by-byte loop            01/01/70 00:00      
         is this ok ?            01/01/70 00:00      
            Table bytes comparison            01/01/70 00:00      
               Does 8051 has two DPTR ??            01/01/70 00:00      
                  Same DPTR if you don't have two            01/01/70 00:00      
                  Please crarify settings of board/device            01/01/70 00:00      
                     for the moment...            01/01/70 00:00      
                  WHY ON EARTH            01/01/70 00:00      
                     Yes I know what they are...            01/01/70 00:00      
                        Why even keep the received data in an array?            01/01/70 00:00      
                           Please read....            01/01/70 00:00      
                              I have - have you?            01/01/70 00:00      
                                 Yes please            01/01/70 00:00      
                                    you can't store in code memory            01/01/70 00:00      
   Is this code ok ??            01/01/70 00:00      
      Wrong focus for comments - and untested code            01/01/70 00:00      
         I have tested !!            01/01/70 00:00      
            do you have that much external RAM?            01/01/70 00:00      
            No. You think you have tested but not multiple turns            01/01/70 00:00      
            Experimenting with 8051 embedded            01/01/70 00:00      
               thank you...            01/01/70 00:00      
                  Here we are again....            01/01/70 00:00      
                     take a look !!            01/01/70 00:00      
                        Baudrate            01/01/70 00:00      
                           thanks            01/01/70 00:00      
                           yes, but better            01/01/70 00:00      
                              Question            01/01/70 00:00      
                                 difference between ORG 000H and ORG 113H            01/01/70 00:00      
                                    usually.....            01/01/70 00:00      
                                       Now do you understand...            01/01/70 00:00      
                                 ORG is not an instruction, it is ...            01/01/70 00:00      
                                    PLEASE SEE THIS AND HELP !!            01/01/70 00:00      
                                       Copied "END" without first reading what it meant?            01/01/70 00:00      
                                       step-by-step mode            01/01/70 00:00      
                                          thank you            01/01/70 00:00      
                                             Assembler way is difficult            01/01/70 00:00      
                                                Thank you.....            01/01/70 00:00      
                                                   Step through the examples            01/01/70 00:00      
                                                      Of course            01/01/70 00:00      
                                                         THANK YOU ALL            01/01/70 00:00      

Back to Subject List