4-bit interrupt coding

i need to use a 4-bit interrupt...can ne1 pls tel me how to develop the code????

Your question doesn't make much sense - can you tell us what it is you want to do, not how you think you need to do it?

vinay_4evrmanutd:
...can ne1 pls tel...

Can you write your question by using C only, would it be easier?
:fearful:

Kari

"4-bit interrupt"
Don't even know what that means.

i'm giving a 4-bit input 2 a atmega644p..i need this input data as interrupt...since there are only 2 interrupt pins in 644p..how do i configure it other pins as interrupt pins???

Here are a few ways to create an interrupt from several pins.

Have the same inputs as normal I/O pins also, and read them as part of the interrupt to see which created it.

Another option is to use PCINTs and have each I/O pin create an interrupt, altho that is a little more complicated in the software.

Would this work? Connect the data to the 4 pins (as CrossRoads said), in my example D3 to D6, and then also connect them to 4 MOSFETs configured as open-drain, so if any one goes high they pull the interrupt pin (D2) low, otherwise the pull-up resistor keeps it high.

I'm trying to teach myself this stuff so correct me if I got it wrong. Of course, the single dedicated part is simpler, if you have it to hand.

Open_Drain_Example.png

You have P-Channel FETs depicted, you need N-Channel FETs (arrow points the other direction) to use them that way (or NPN transistors).
If they are not Logic Level FETs you May not see them turn on enough to create a good Low for the interrupt. Depends on the part selected.

OK, so something like below?

Possibly part 2N7000 (MOSFET, N, LOGIC, TO-92).

Open_Drain_Example2.png

i'm using a dtmf circuit...i was searching nd found pind() command...can it be used??

@Nick, 2N7000 looks like it would work. Any simple diode is all you really need tho.
If use the internal pullup on D2 the external 4.7K may not even be needed. I don't have any on my RF remote below, I just use the internal.
In that design, I go into sleep mode and write the column pins low, so that when a key is pressed the row connects to a low to create the interrupt.
On the interrupt I write the columns high and the keypad library takes over to find the key that was pressed.

@vinay: "I'm trying to use PIND to read a byte from port d as digital." you want to do something like that, with inputs on 4 of the D0-D7 pins?
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1258045050
Seems like it could work.

CrossRoads:
@Nick, 2N7000 looks like it would work. Any simple diode is all you really need tho.

Oh that looks great! I always like the simple solution. Drat, and I thought I had a use for open-drain too. :wink:

So D2 is pulled high, and any low transition causes the interrupt. Meanwhile the diodes stop the key buttons from interfering with each other.

DTMF detectors normally have a separate single "tone detect" output.
Use this as your interrupt, and read off the value from separate pins.
Which DTMF device are you using?