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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
01/21/10 20:27
Read: times


 
#172649 - The loop in ASM
Responding to: ???'s previous message
I've been stepping through the low-level code with the assembler. Is there an advantage to explicitly writing the code into an assembly file as opposed to emulator stepping?

In the following code, unsignd char i lives at 0x0437.

    96:                 for (i=0;i<255;i++) 
C:0x031A    900437   MOV      DPTR,#0x0437
C:0x031D    E4       CLR      A
C:0x031E    F0       MOVX     @DPTR,A
C:0x031F    900437   MOV      DPTR,#0x0437
C:0x0322    E0       MOVX     A,@DPTR
C:0x0323    FF       MOV      R7,A
C:0x0324    EF       MOV      A,R7
C:0x0325    C3       CLR      C
C:0x0326    94FF     SUBB     A,#0xFF
C:0x0328    5008     JNC      C:0332
    97:                 { 
    98:                 } 
    99:                  
C:0x032A    900437   MOV      DPTR,#0x0437
C:0x032D    E0       MOVX     A,@DPTR
C:0x032E    04       INC      A
==> C:0x032F    F0       MOVX     @DPTR,A
C:0x0330    80ED     SJMP     C:031F

 


The line with the "==>" is where the loop hangs since location 0x0437 is not populated with A.

I've noticed that when the emulator uses its internal clock at 12 MHz the loop "never" (haven't caught it yet) hangs. When I set the internal emulation clock to 11.059MHz or use my target hardware clock (also 11.059MHz) than the hang comes back. On the scope, the target hardware clock signal looks stable and clean. I'm not too sure on how the emulator POD generates multiple clock frequencies and will look into that.

List of 30 messages in thread
TopicAuthorDate
Simulation vs. Embedded Discrepancy            01/01/70 00:00      
   Hardware fault?            01/01/70 00:00      
      Responding to: Andy Neil's previous message            01/01/70 00:00      
   illustration of edge difference?            01/01/70 00:00      
      SPI Phase/Polarity            01/01/70 00:00      
         address instead of value            01/01/70 00:00      
            Doesn't seem coincidental            01/01/70 00:00      
               MOVX command fails            01/01/70 00:00      
                  Definitely sounds like a hardware fault!            01/01/70 00:00      
                  Have you tried doing this in ASM?            01/01/70 00:00      
                     The loop in ASM            01/01/70 00:00      
                        I think...            01/01/70 00:00      
                        Sounds like hardware again            01/01/70 00:00      
                           If this were reduced to the essentials ...            01/01/70 00:00      
                              Oh Richard            01/01/70 00:00      
                        What I was after ...            01/01/70 00:00      
                           Reducing to Essentials            01/01/70 00:00      
                              RE: Magic Switch On The Compiler            01/01/70 00:00      
                                 Emulator trace            01/01/70 00:00      
                                    Yes            01/01/70 00:00      
                                       SOLVED            01/01/70 00:00      
                                          A bit ocnfused            01/01/70 00:00      
                                             Emulator and AUXR            01/01/70 00:00      
                                                Things do tend to work best...            01/01/70 00:00      
   one guess with a question            01/01/70 00:00      
      Memory has plenty of gaps            01/01/70 00:00      
         That doesn't make sense!            01/01/70 00:00      
            Sloppy language on my part            01/01/70 00:00      
      Am I missing something            01/01/70 00:00      
      questions/request            01/01/70 00:00      

Back to Subject List