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
I think A51 understands C51 header files, doesn't it? Thats news for me. I just tried it. It fails on C syntax. But it seams to work on preprozessor commands.
Of what i use, it "understands" all except struct and such. I use it extensively. Even conditional assembly can be contrilled by #define. So where I used to have a .h and a .inc for C and assembly, I now have a .h with the mutually digestable stuff and a .h with the structs which the assembly does not use anyhow. This is a much safer operation than the old .h and .inc. Erik
and a .h with the structs which the assembly does not use anyhow And you could reasonably easily do away with that secondary file, too: just put (an equivalent of)
#if defined(__C51__) || defined(__CX51__) #endif