??? 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. |