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

import a port pin as external bit into A51 file

Hi,

I've a bit banging I2C implementation that uses port pins. Now I'd like to use it in several projects. But the projects have their I2C pins on different locations :-(

I think there is no way to pass the address of a bit (port pin) to a function. As there is no indirect addressing in bit instructions it wouldn't help much anyway.

So the only solution I have found so far is to define the I2C pins for every project and compile the module again. This is a thing I'd like to avoid.

So I thought of importing an 'EXTRN bit(scl)' and declare the bit in another C-Module. So far all I've got are linker errors. Any idea how to do this?

TIA

Bernhard 'Gustl' Bauer

Parents
  • Hi,

    thanks for your quick response. Your link was very intresting, but didn't help much.

    Linker reports actually a warning:
    *** WARNING L2: REFERENCE MADE TO UNRESOLVED EXTERNAL
    SYMBOL: SDAB

    In a C file I had: "sbit SDAB = P2^3;"

    I tried the combination:
    EXTRN NUMBER(SDAB)
    unsigned char idata SDAB _at_ 0xA3;
    It results in linker error:
    *** ERROR L121: IMPROPER FIXUP

    So I asume that the linker recognize somehow that SDAB must be inside bdata and doesn't allow greater addresses than 127.

    Bernhard 'Gustl' Bauer

Reply
  • Hi,

    thanks for your quick response. Your link was very intresting, but didn't help much.

    Linker reports actually a warning:
    *** WARNING L2: REFERENCE MADE TO UNRESOLVED EXTERNAL
    SYMBOL: SDAB

    In a C file I had: "sbit SDAB = P2^3;"

    I tried the combination:
    EXTRN NUMBER(SDAB)
    unsigned char idata SDAB _at_ 0xA3;
    It results in linker error:
    *** ERROR L121: IMPROPER FIXUP

    So I asume that the linker recognize somehow that SDAB must be inside bdata and doesn't allow greater addresses than 127.

    Bernhard 'Gustl' Bauer

Children