Pages: 1 [2]   Go Down
Author Topic: Accessing a "Wire" object from an interrupt routine == hang, need solution  (Read 1402 times)
0 Members and 1 Guest are viewing this topic.
Pittsburgh, PA, USA
Offline Offline
Faraday Member
**
Karma: 99
Posts: 4837
I learn a bit every time I visit the forum.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

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

Logged

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

New Jersey
Offline Offline
God Member
*****
Karma: 2
Posts: 537
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


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.

Logged

Anaheim CA.
Offline Offline
Faraday Member
**
Karma: 48
Posts: 2935
...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Logged

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

UK
Offline Offline
Faraday Member
**
Karma: 100
Posts: 4153
Where is your SSCCE?!?!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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).
Logged

Get 10% off all 4D Systems TFT screens this month: use discount code MAJENKO10

Pages: 1 [2]   Go Up
Jump to: