I am testing a basic timer example in keil (8051 ) when I debug this code

org 0
MOV TH0,#76
MOV TL0,#01

I get the error

    error 65 access violation at c: 0x000e no execute read permission

Please I need help to solve this problem


You have a classical mistake here. You have made no provisions as to what your program should be executing after you get to address 0x000E.

Here take a look:

C:0x0000    758C4C   MOV      TH0(0x8C),#0x4C
C:0x0003    758A01   MOV      TL0(0x8A),#0x01
C:0x0006    758901   MOV      TMOD(0x89),#0x01
C:0x0009    D28C     SETB     TR0(0x88.4)
C:0x000B    308DFD   JNB      TF0(0x88.5),C:000B
C:0x000E    ????     ???      ??? ???

Just because you put an "end" statement in your assembly language source code means nothing to the run time 8051 core trying to fetch instructions.


Debug->Memory Map, make sure that the memory map is properly enabled for read/write (say 0x0000 to 0xFFFF)

  • \$\begingroup\$ See Michael's answer for why the debug map does not cover your uninitialized memory. An accurate debugging session would follow the CPU as it merrily executes whatever (possibly random or 0xFF bytes) is in the program memory following your program fragment. 0xFF is MOV R7,A. \$\endgroup\$ – Spehro Pefhany Sep 1 '17 at 4:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.