Keil Logo

C251: ACCESSING ASSEMBLY ECODE VARIABLES FROM C


Information in this article applies to:

  • C251 Version 1.24
  • C251 Version 2.14
  • C251 Version 3.00

QUESTION

How do I create ECODE tables in assembly and access them from C?

ANSWER

The following assembly code defines a table named tab in ECODE (or far const) memory:

?HC?T_ASM  SEGMENT  HCONST
        RSEG       ?HC?T_ASM

tab:
        DB  001H
        DB  002H
        DB  003H
        DB  004H
        DB  005H

PUBLIC        tab

The following C code will read the contents of this table:

extern unsigned char const far tab [];

void main (void)
{
unsigned char tab_copy [5];
unsigned char i;

for (i = 0; i < 5; i++)
  tab_copy [i] = tab [i];

while (1);
}

Last Reviewed: Thursday, January 11, 2001


Did this article provide the answer you needed?
 
Yes
No
Not Sure
 
  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.