This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Function Pointer - Look Up Table

Hello,

I'm using a 80C51 with the MX - extension in my design.
I want to build up a look up table (ROM) that contains the addresses of several functions. The address of each function must be split into high, middle and low - byte so that i can use it later as a "jump - table" in assembler.

For example:
/* some functions. */
void fA();
void fB();
void fC();

/* Look up table: */
static code LUT [3][3] = {H(fA), M(fA), L(fA), {H(fB), M(fB), L(fC),...

I've already tried some macros which i found in other posts like:

#define L_B(v) (*(((unsigned char *) (&v) + 0)))

This macro doesn't work with function - addresses but works well on common pointers.

Best regards,
Patrick

0