Go Down

Topic: Accessing a "Wire" object from an interrupt routine == hang, need solution (Read 4784 times) previous topic - next topic


And for getting simultaneous i/o, and as pin multipliers....

Some time I should start collecting logic gates and flip-flops.

1) http://gammon.com.au/blink  <-- tasking Arduino 1-2-3
2) http://gammon.com.au/serial <-- techniques howto
3) http://gammon.com.au/interrupts
Your sketch can sense ongoing process events in time.
Your sketch can make events to control it over time.


If you want to use I2C from within an interrupt routine you will have to write your own (or find one if you're lucky) I2C library that doesn't use interrupts in its operation. 

I'm pretty sure this library doesn't use interrupts:

It only acts as a master, not slave.  It also uses less memory then wire.h.


Use the interrupt signal from the port expander to take a snapshot of the bus with an octal D flip/flop or bus latch... Note it in the interrupt and then go service the bus latch later.


--> WA7EMS <--
"The solution of every problem is another problem." -Johann Wolfgang von Goethe
I do answer technical questions PM'd to me with whatever is in my clipboard


Some other thoughts:

1. Switch to SPI so your data transfer times are reduced.
2. Consider a "slave" device that provides the IO facilities and services the interrupts locally then only sends the results back to the master.
3. Use a combination of shift register and external circuitry to create your own IoC signal and then perform a single byte shift-in. (Somewhat complex and bulky, but fun to do - great for learning about flip-flop circuitry).

Go Up