Here's a brief description of what i am trying to do -
I am writing code to replicate open collector communication bus (like I2C).
The device is sending clock and data. The host can take control whenever it likes to.
The host does this by pulling down clock LOW for 100usecs. The device has to respond withing a few millisecs.
I am detecting the 100usecs by using timer interrupt with clock pin input for count direction. (is there a better way?).
with this setup, the timer counts both ways. But I only want it to count down.
when there is no request by host, the device continually keeps transmitting data. so this is in a while loop.
while(! host_request)
But this doesn't work. After completing the host request, there will be nothing to do.
It has to get back to continuous transmission of data.
Any suggestions.
Device is C8051F120
silabs IDE.