Generating INterrupts from XBee pin to ATmega

The XBee at the recieving end is connected to the Pro Mini and is receiving through UART but the thing is that I need to provide the interrupt to the pro mini so that it goes out of the running programme where ever it is and to do so I need the XBee pin to get fired on receiving pin#2 on the pro mini so that the Interrupt routine gets fired and get outs of the code snippet.

How to go through about this ? I have done the setup using the guidance from Rob Faludi's post here >> http://www.faludi.com/2006/12/03/xbee-direct-io-with-adc/

but as the Pin is not connected it is floating and is just reading so endless array of characters run through getting me nothing whereas i need a solution where XBee receives something like an AT command to have its PIN configured as Digi out ON and it provides an interrupt to the pro mini

EDIT: The main thing is that the XBee's are working on the basis of sampling that it sends automatically pin configuration as per the sampling frequency time defined by us but in my case it needs to send the command which controls the Pin of XBee only when it recieves some specific commands which tells it to do so.

The XBee at the recieving end is connected to the Pro Mini and is receiving through UART but the thing is that I need to provide the interrupt to the pro mini so that it goes out of the running programme where ever it is and to do so I need the XBee pin to get fired on receiving pin#2 on the pro mini so that the Interrupt routine gets fired and get outs of the code snippet.

You use the definite article a few times in that sentence ("The XBee" "the receiving end" "the code snippet" etc), without offering examples.

Can you use "serialEvent"?

I managed to get them rightly configured :

OUTPUT MODULE:
ATID3456 –> PAN ID
ATMY2 –> my address 2
ATDL1 –> destination address 1
ATP02 –> PWM 0 in PWM mode//skipped this as donot need
ATD15 –> output 1 in digital out high mode//changed it to D2 as im using D2
ATIU1 –> I/O output enabled//by default its 1 only
ATIA1 –> I/O input from address 1//skipped it but im not sure of this one i think i need it
ATWR –> write settings to firmware// done

INPUT MODULE:
ATID3456 –> PAN ID
ATMY1 –> my address 1
ATDL2 –> destination address 2
ATD02 –> input 0 in analog mode//skipped this
ATD13 –> input 1 in digital in mode//changed it to D2 as im using D2
ATIR14 –> sample rate 20 milliseconds (hex 14)//skipped this
ATIT5 –> samples before transmit 5//skipped this
ATWR –> write settings to firmware//done

from: >> http://www.faludi.com/2006/12/03/xbee-direct-io-with-adc/

The XBee's are talking Definitely i have verified that BUT still the D2 pin is not toggling as i want

EDIT: I do not know what is SerialEVENT? and how it is going to be useful.

I read about the Serial Event the case with my implication is that i need to exit a loop which will else be running till it ends so in order to exit that loop i need an INterrupt or else that Loop/function will go on until its completed i want that in between if i want i can revoke that function.

Still not able to Make the I/O's go High/Low of the XBee , im doing everything correctly, these guys here >> http://fab.cba.mit.edu/classes/MIT/863.10/people/jie.qi/xbee_tut.html tell that after making the desired connects and configuration enter>>
+++
ATD2=5(press enter)
ATWR(press enter)

I have tried putting 4 also in place of 5 but things just don't work.

Can we stop playing "20 Questions", and see some code?

The code is to be written with these elements only which aren't coming in straight. The ONLY thing needed here is utilising the PIN on the XBee to Turn any one of it ON or OFF that's it and it needs using the X-CTU or anyother terminal programme because as you and all of us know that XBee is not storing any Code/Logic on it even then we can control its I/O pin's.

But for clarification here is the Code its basically a loop that runs till the end and i want to get out of it and ONLY it can happen if we use INterrupts as the Code willl not do anything unless this part is completed so there is no other way of stopping this loop in between.

 if (Data == "lnslowTELE") {//Zoom in Slowest
   for (int i = 0; i < 250; i++) {
cmdRepeatCount = 0;
Serial.println(i);
while (cmdRepeatCount < 5) {  //repeat 5 times to make sure the camera accepts the command

                while (pulseIn(lancPin, HIGH) < 5000) {   
                  //"pulseIn, HIGH" catches any 0V TO +5V TRANSITION and waits until the LANC line goes back to 0V 
                  //"pulseIn" also returns the pulse duration so we can check if the previous +5V duration was long enough (>5ms) to be the pause before a new 8 byte data packet
//Loop till pulse duration is >5ms
}

//LOW after long pause means the START bit of Byte 0 is here
delayMicroseconds(bitDuration);  //wait START bit duration

//Write the 8 bits of byte 0 
//"18hex" or “00011000”  tells the camera that there will be a normal command to camera in the next byte
//Note that the command bits have to be put out in reverse order with the least significant, right-most bit (bit 0) first
digitalWrite(cmdPin, 0);  //Write bit 0. 
delayMicroseconds(bitDuration); 
digitalWrite(cmdPin, 0);  //Write bit 1 
delayMicroseconds(bitDuration);  
digitalWrite(cmdPin, 0);  //Write bit 2
delayMicroseconds(bitDuration); 
digitalWrite(cmdPin, 1);  //Write bit 3
delayMicroseconds(bitDuration);  
digitalWrite(cmdPin, 0);  //Write bit 4
delayMicroseconds(bitDuration);
digitalWrite(cmdPin, 1);  //Write bit 5 
delayMicroseconds(bitDuration);
digitalWrite(cmdPin, 0);  //Write bit 6
delayMicroseconds(bitDuration); 
digitalWrite(cmdPin, 0);  //Write bit 7
delayMicroseconds(bitDuration);
//Byte 0 is written now put LANC line back to +5V
digitalWrite(cmdPin, LOW);
delayMicroseconds(10); //make sure to be in the stop bit before byte 1

while (digitalRead(lancPin)) { 
//Loop as long as the LANC line is +5V during the stop bit
}

//0V after the previous stop bit means the START bit of Byte 1 is here
delayMicroseconds(bitDuration);  //wait START bit duration

//Write the 8 bits of Byte 1
//"33hex" or “00110011” sends the  Record Start/Stop command
//Note that the command bits have to be put out in reverse order with the least significant, right-most bit (bit 0) first
digitalWrite(cmdPin, 0);  //Write bit 0 
delayMicroseconds(bitDuration);
digitalWrite(cmdPin, 0);  //Write bit 1 
delayMicroseconds(bitDuration); 
digitalWrite(cmdPin, 0);  //Write bit 2
delayMicroseconds(bitDuration); 
digitalWrite(cmdPin, 0);  //Write bit 3
delayMicroseconds(bitDuration);
digitalWrite(cmdPin, 0);  //Write bit 4 
delayMicroseconds(bitDuration); 
digitalWrite(cmdPin, 0);  //Write bit 5
delayMicroseconds(bitDuration);
digitalWrite(cmdPin, 0);  //Write bit 6
delayMicroseconds(bitDuration);
digitalWrite(cmdPin, 0);  //Write bit 7
delayMicroseconds(bitDuration);
//Byte 1 is written now put LANC line back to +5V
digitalWrite(cmdPin, LOW);

cmdRepeatCount++;  //increase repeat count by 1

/*Control bytes 0 and 1 are written, now don’t care what happens in Bytes 2 to 7
and just wait for the next start bit after a long pause to send the first two command bytes again.*/


  }//While cmdRepeatCount < 5
   }
}

SO in a Nutshell the Inner loop goes for about 250 x 5 loops in total that is a whopping 1250loops , IT ALL WORKS FINE and to complete the process it takes about 22 seconds so for example if in between this loop is functioning and i want to stop it then it can only be stopped via. interrupt interrupting its flow and XBee's are pretty capable of working on AT commands without even any uC so when the uC is Busy working on this loop XBee is still listening and fine so it can be given an AT command to TURN ON a i/o pin and shoot INterrupt on Hardware interrupt pin#2 of Arduino Pro Mini.

My eyes!
Please, run auto format.

I solved the Problem! now its happening , WHat i did is configured the base as Input and the remote as the output and so as i changed the pins on the base the remote also copied the same changes.

BUT to hold on to the changes on the remote you need to do ATIA MYID of the Base and that's it.

NOW another problem i can toggle the state of the pin using the X-CTU but not the terminal programme

can i not simply do the:
+++
ATD2=5(enter)
ATWR(enter)

or i need to supply this in Serial.print

I tried the commands in Serial.print("");

but they aren't working this way what say? Do i need to give Serial.Write commands because they send Binaries or HEX's??