I need some help with code after a Single step through lines 1-5 using uVision2. Will the entire code segment be executed with the current values in P0? Why? Alter the value of P0 within the debugger to enable the program to continue execution. Single step through lines 6 and 7. Display and record the contents of data memory location 20h, using the memory window

mystuff  segment  data 
rseg   mystuff  
myvar:   DS   1  
mycode  segment  code 
rseg  mycode 

; 1-13 are lines of the code 

1   MOV 80H, #0FFH ;initialize P0 to 0FFH 
2   MOV A,#10 
3   MOV R0,#20H 
4 LOOP:  JNB P0.2,NEXT 
5   JMP LOOP 
6 NEXT:  MOV @R0,80H 
7   CLR 07H 
8 TIME:  DEC A 
9   JNZ TIME 
10   MOV myvar,#42H 
11   NOP 
12   NOP 
13  END

Thank you in advance

What's your question? You've just posted your assignment.


after a Single step through lines 1-5 using uVision2. Will the entire code segment be executed with the current values in P0? Why? Alter the value of P0 within the debugger to enable the program to continue execution.

I don't know how to fix the code

There isn't anything wrong with it.

if you run it with Keil it will never pass the " loop "

Line 12 says jump to next if P0.2 is not set.
You need to clear P0.2.

Line 12 says jump to next if P0.2 is not set.
You need to clear P0.2.

Do I clear before LOOP: JNB P0.2,NEXT
or before JMP LOOP and after LOOP: JNB P0.2,NEXT

Thank you for your help

Only line 12 tests if the pin is clear.
Line 13 might never be executed.

Now i got an error says

ERROR 65 (ACCESS VIOLATION) no 'execute / read ' permissions

Am I missing something ? Thank you

You've stepped passed the end of your program. Are you asking stupid questions on purpose?