Knowing when a packet arrives XBEE S1

I want to know if it is possible to activate a pin whenever a packet arrives to XBee.

My idea is to activate a pinin XBee, connected to an arduino, which use an interrupt for using some functions…

I read something about pin 6 but I think this is pwm and I don’t know if I can use it as 1 or 0 depending if there is data in uart or not…

The packet data will be sent out of the XBees Dout (serial) pin if RTS is low (if enabled).

The typical method is to have the arduino serial UART enabled and then trip an interrupt when data arrives in the arduino’s UART. The ISR then handles incoming serial data.

You mean, with first byte received generate the interrupt? So I should attach a wire between XBee Rx and Interrupt pin in Arduino?

No, the arduino’s UART produces the interrupt internally.

You need arduino code to setup its UART for interrupt on receiving data.

If you connect the XBee Dout line to the arduino interrupt input this will tell the arduino that the XBee got data but this data would then be lost unless the interrupt handler does a serial ‘bit-bang’ receiver.

Exactly what is it you wish to do?

I want to do a program which keeps running all the time without checking if a packet was received. But, each time a packet arrives, it stops to do whatever it was doing and read the packet.

OK. Have the arduino’s UART produce an interrupt when data arrives. The interrupt is handled in an ISR that reads the data out of the UART and places it in a ring buffer. The ISR then sets a flag bit that the ‘main’ code loop that polls the flag bit to know when there is data to start processing the incoming packet.

I don’t use the arduino so don’t have any code you you. I use this method in PICs and other processors to handle serial data from a device like an XBee.

Ok, I will check that solution. Thank you for your help!

why not start with the XBee library for Arduinos?