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

Accessing external variables between two files

I have to read 8255 port status from f1.c.The variables corresponding to each port is defined using XBYTE in main.c file.What keyword should I use to implement this?

Thanks & Regards,
Reny.

Parents
  • XBYTE is just a macro - you are effectively using the port address as a "magic number"

    Possibly a better solution would be to use _at_ - see the Manual.
    Then it just becomes a standard 'C' definition in one file, and external declarations in a header for the others.

    There has been plenty of discussion here before on definitions, external declarations and headers - do the search, or see any standard 'C' textbook.

Reply
  • XBYTE is just a macro - you are effectively using the port address as a "magic number"

    Possibly a better solution would be to use _at_ - see the Manual.
    Then it just becomes a standard 'C' definition in one file, and external declarations in a header for the others.

    There has been plenty of discussion here before on definitions, external declarations and headers - do the search, or see any standard 'C' textbook.

Children