Keil Logo

CODE

CODE memory can be accessed with the instruction MOVC via the DPTR register.

Example for all 8051 variants
?CO?my_seg SEGMENT CODE                ; define a SEGMENT of class CODE
           RSEG    ?CO?my_seg
TABLE:     DB      1,2,4,8,0x10        ; a table with constant values

?PR?myprog SEGMENT CODE                ; define a segment for program code
           RSEG    ?PR?myprog
           MOV     DPTR,#TABLE         ; load address of table
           MOV     A,#3                ; load offset into table
           MOVC    A,@A+DPTR           ; access via MOVC instruction
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.