attiny85 with I2C and external interrupt

Hi,

I am trying to make a triac dimmer controlled by an attiny85.

I have the dimmer working fine with an ordinary arduino so that part is fine.

My main problem is is that I am using the TinyWireS library to turn the attiny into an I2C slave. This is working fine, but uses pins 7 and 5 (physical)

I need a rising edge interrupt to trigger the triac at the right timing. I gather I need to use the general pin change interrupt on something like physical pin 3 I then need to figure out if it is a rising or falling edge.

I have two questions really:

The first is if some I2C data arrives, will that mess up any timing currently going on in my program, or will that just be put into a buffer for me to retrieve later without messing with any other execution going on?

Secondly; does anyone have a barebones example of a rising edge interupt on any pins other than 7 and 5? I would really appreciate it!

Thanks for any hints anyone can offer!

Best regards,

Rhys.

Dubbie:
The first is if some I2C data arrives, will that mess up any timing currently going on in my program, or will that just be put into a buffer for me to retrieve later without messing with any other execution going on?

Section 15 of the datasheet tells me that there's a 1 byte deep FIFO on the USI data input and that there are 2 interrupt control bits that can be used to enable/disable serial bus interrupts. You should be able to have the Tiny receive 8 bits and poll the USI status register to see it data has been received ... thus no interrupts to disturb your timing.

http://www.atmel.com/Images/Atmel-2586- … asheet.pdf

Good to know! Thanks for the info. Since I posted this I have set up Atmel Studio and switched from using the Arduino libraries to plain AVR C++. I have been slowly working through the basics, io, timers, interrupts etc. I have also been delving into the data sheet. My head is spinning from everything I have needed to learn to even get back to where I was but I figure it is worth it.

Any extra hints still gratefully received!

R