Pages: 1 [2]   Go Down
Author Topic: Accessing a "Wire" object from an interrupt routine == hang, need solution  (Read 830 times)
0 Members and 1 Guest are viewing this topic.
Pittsburgh, PA, USA
Offline Offline
Faraday Member
**
Karma: 58
Posts: 4016
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

Examples can be found in your IDE.

New Jersey
Offline Offline
Sr. Member
****
Karma: 1
Posts: 482
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: 44
Posts: 2808
...
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: 92
Posts: 3969
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

Why not visit my eBay shop? http://stores.ebay.co.uk/Majenko-Technologies
Replacement for the Arduino IDE: UECIDE - Proper serial terminal, graphing facilities, plugins, overhauled internals.
Java isn't bad in itself, but it has enabled morons to write programs.

Pages: 1 [2]   Go Up
Jump to: