Serial object and DI/O object on same pins

05 Oct 2012

Hello,

For reasons I won't get in to, I need to have a DI/O and serial object share some of the same pins (the tx pin on the serial port). I know I could probably make this work by destroying the old object and creating a new one each time control needs to switch, but because of data stored in the class I have that inherits Serial that is not a practical solution.

I assume the settings for the crossbar/pin multiplex registers are written in the constructors for the DI/O and Serial objects. So would it work to go in myself and write the proper bits to those registers when I wanted to switch control? I would obviously make sure that the "dormant" object would not try to access its pins until it is "active" again.

Has anyone done/had to deal with something like this? Any easy solutions?

Thanks a ton for any help.