Go Down

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

GoForSmoke

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

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

I find it harder to express logic in English than in Code.
Sometimes an example says more than many times as many words.

ScottG



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:
http://dsscircuits.com/articles/arduino-i2c-master-library.html

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


Docedison

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.

Doc

--> 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

majenko

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).
Get 10% off all 4D Systems TFT screens this month: use discount code MAJENKO10

Go Up