Keil Logo Arm Logo

CODE and CONST

CODE or CONST memory may be accessed with the instruction MOVC via the DPTR register.

Example for for all 251 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

Keil logo

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.