ahem, my comment was confusing.
sub SetToMaster()
twcr.0 = 0 'disable
end sub
sub SetToSlave()
twcr.0=1 'enable
end sub
That way it should work. But you must switch when the bus is free.
Do you use Proteus? if you make me a proteus i will check it.
The slave driver work on interrupt so it need an enabled interrupt.
The master does not work in int mode so that is why you need to disable it.
And other wise you can test this :
after you loaded the master, save the register content of twcr , then do the same after the slave mode, and then write the backed up master value.
↧