xbee communicate thoery

another question. can you explain xbee communicate theory? When it transmit data, it also can receive data? so when it receives data, the data it wants to send will be stored in buffer temporary? Then it received data is finished, then it will continue sending data.

In networking and security setting, how many parameters I need set?

except DH,DL,SH,SL, is there anything else?How about ID setting? Its default is 0. I think that maybe I should set different value for TX xbee and RX xbee, right?

MY default value is 0. need I set 0xFFFF to disable 16-bit address reception of packets? Or, what should I set?

in MM, what should I set? use 0, or use 1,or 2? I totally don’t understand how 802.15.4 protocol works.

This is the setting now in my two xbee.

setting   TXxbee        RXxbee
CH           C                C
ID         3332            3332
DH        13A200        13A200
DL        4054D4D1     4054D4D3
MY          0                  0
SH       13A200         13A200
SL       4054D4D3     4054D4D1
RN          0                  0
MM          0                  0

read about IEEE 802.15.4.

It’s a Time Division Duplexing protocol, as is 802.11. One frequency is used in both directions, per the 802.15.4 defined MAC and PHY.

Thanks for your words. And now I am reading the protocol.

It is hard and impossible for me to understand it. But I have no idea, and I have to read it.

stevech:
read about IEEE 802.15.4.

It’s a Time Division Duplexing protocol, as is 802.11. One frequency is used in both directions, per the 802.15.4 defined MAC and PHY.

ceibawx:
Thanks for your words. And now I am reading the protocol.

It is hard and impossible for me to understand it. But I have no idea, and I have to read it.

stevech:
read about IEEE 802.15.4.

It’s a Time Division Duplexing protocol, as is 802.11. One frequency is used in both directions, per the 802.15.4 defined MAC and PHY.

Read the Digi XBee user guides. THey simplify it.

Thanks.:smiley:

Now I know that my xbees connected to PC, they do communicate. So the problem is still in PIC code.

One question is , can I set RCSTA,SPEN bit every time? So when one byte is sent, SPEN is set one time. So there are 8 bytes data needed to send, I have to set SPEN bit for 8 times. Is it right?

I am wondering.

Another question is before I send a byte, I need check three flag bit. First is CTS bit, which is connected toXBEE CTS pin and tell us XBEE enable PIC to send data to XBEE or not.

Second is TXSTA,TRMT, which shows TSR empty or full, and tell us the last byte sending is successful or not.

And the last one is PIR1,TXIF, which shows TXREG is empty or full.

And now my code is followed.Can you see it for me?

Main:
       banksel   TRISC
       bcf       TRISC,6            ;c6=0 as output
       
; UART module setup
       banksel   SPBRG
       movlw     0x14                 ; rs232 baud as 57.6k as 0x15
       movwf     SPBRG              ; Enable SPBRG register Baud Rate

       banksel   TXSTA               ; Select memory bank for TXSTA SFR             
       bcf       TXSTA,TX9              ; 6----8-bit transmission
       bsf       TXSTA,TXEN             ; 5----Enable Transmission/set  
       bcf       TXSTA,SYNC             ; 4----Asynchronous mode
       bsf       TXSTA,BRGH             ; 2----High Baud Rate
       

       banksel   RCSTA
       bcf       RCSTA,RX9          ; 6
       bsf       RCSTA,SPEN         ; 7----cause TXIF=1----cause TRMT=1 --no????
       bsf       RCSTA,CREN         ; 4
       
Loop:
       MOVLW     0x42  ; substitute your code to load W here
       CALL      SerialTX
       MOVLW     0x45
       CALL      SerialTX
       MOVLW     0x39
       CALL      SerialTX
       MOVLW     0x27
       CALL      SerialTX
       MOVLW     0x15
       CALL      SerialTX
       MOVLW     0x58
       CALL      SerialTX
       MOVLW     0x63
       CALL      SerialTX
       MOVLW     0x91
       CALL      SerialTX
       CALL      Delay20us ; this would be your delay routine
       
       GOTO      Main

SerialTX:      
       BANKSEL   PORTC  
       BTFSC     PORTC,5  ;CTS=PORTC,5, TEST C5,  CTS
       GOTO      SerialTX
       BANKSEL   TXSTA
       BTFSS     TXSTA,TRMT       ;TXSTA,1 =default value is 1.
       GOTO      SerialTX         ; make sure data transmission is sucessful ?       
       BANKSEL   PIR1
       btfss     PIR1,TXIF        ;PIR1,4
       goto      SerialTX
       movwf     TXREG            ;cause TRMT=0, FULL. causing 2nd data is not given to TXREG.
       CALL      Delay20us
       return 
Delay20us:
       BANKSEL   RCSTA    ;05,A5=170us;03,F5=120US;2,F5=0;03,D5=6US-ERROR
       MOVLW     0x06   ;03,C5=O DELAY;06/D5=320
       MOVWF     0x20   ;
LOOP2:
       MOVLW     0x15   ;
       MOVWF     0x21   ;
LOOP1:
       DECFSZ    0x21,F
       GOTO      LOOP1
       DECFSZ    0x20,F
       GOTO      LOOP2
       BANKSEL   RCSTA
       BSF       RCSTA,SPEN  
       
       return
       

       END
;*********************transmit data finish******************************

[/code]

Not using the UART interface to the XBee?

Sorry I don’t understand your words.

And now PIC output data can communicate with xbee.

And now my question is how to use flow control in xbee?

this afternoon I selected hardware in X-CTU software, but I still don’t know how to use flow control of xbee. Who can help me?in X-CTU, if I choose assert RTS, which means that RTS keeps lower. And CTS IS ALWAYS GREEN. How can I check CTS STATE IN X-CTU? If it is not allowed in x-ctu, Can you tell me how to poll it?

The reason is that data from RX xbee always move forward at every about 1000 bytes, when I transmit data from TX xbee with delay of 1ms.The moving forward reason, I found that it is always 1or 2 bytes are lost on RX Xbee when about 1000bytes are sent from TX xbee. So if I transmit data with delay but repeatly, there are shifting forward in receiving data in RX xbee.

While less than 1000bytes data is sent, on RX Xbee no lost happen. So I want to poll CTS and RTS state when communication. But I failed.

ceibawx:
Sorry I don’t understand your words.

And now PIC output data can communicate with xbee.

And now my question is how to use flow control in xbee?

this afternoon I selected hardware in X-CTU software, but I still don’t know how to use flow control of xbee. Who can help me?in X-CTU, if I choose assert RTS, which means that RTS keeps lower. And CTS IS ALWAYS GREEN. How can I check CTS STATE IN X-CTU? If it is not allowed in x-ctu, Can you tell me how to poll it?

The reason is that data from RX xbee always move forward at every about 1000 bytes, when I transmit data from TX xbee with delay of 1ms.The moving forward reason, I found that it is always 1or 2 bytes are lost on RX Xbee when about 1000bytes are sent from TX xbee. So if I transmit data with delay but repeatly, there are shifting forward in receiving data in RX xbee.

While less than 1000bytes data is sent, on RX Xbee no lost happen. So I want to poll CTS and RTS state when communication. But I failed.

With series 1 XBees I just configured for hardware flow control (RTS/CTS) and had the host micro or PC check CTS before sending each byte. No problems. You can also use software XON/XOFF= a config option

Hi Stevech,

first, I understand half your words. I did write CTS check in PIC code.This is from PIC to TX XBEE.

Second, I still don’t understand how to do the check in RX XBEE.What does “XON/XOFF” mean? In test I only chose “HARDWARE”. If I choose “XON/XOFF”, what will it happen? What’s the difference from “HARDWARE”?

Third, How to understand

"interface at a lower baud rate[BD(Interface data rate) parameter] than the throughput data rate"in PAGE 11 OF XBEE802.15.4[2008.09.04]

What does "receiving RF data in the network" mean ? It means the data from another xbee module? It refers the acknowledge data from RX module if now the DI buffer is in a TX XBEE?

“The data in the DI buffer will be transmitted over-the-air when the module is no longer receiving RF data in the network”

“product manual” http://www.digi.com/products/wireless/p … module.jsp]

Thanks for your care.

With series 1 XBees I just configured for hardware flow control (RTS/CTS) and had the host micro or PC check CTS before sending each byte. No problems. You can also use software XON/XOFF= a config option

have you PROVEN that the CTS check works in your hardware/PIC code?

do you have the RTS/CTS based flow control enabled in the XBees?

XON/XOFF - google. It is a software flow control method. There are many such.

Ok. I will try now.

In CTS check before I transmit data into TXREG in PIC code.

About XON/XOFF, it is similar to CTS/RTS, right? I think that I should choose hardware in X-CTU flow control options.

Later I give you result.

Xon/Xoff (sometimes written “X-on/X-off” or “XON/XOFF” and pronounced eks-AWN eks-AWF ) is a protocol for controlling the flow of data between computers and other device s on an asynchronous serial connection. For example, a computer typically sends data to a printer faster than the printer can print. The printer contains a buffer where data is stored until the printer catches up with the computer. If the buffer becomes full before the printer catches up, a small microprocessor in the printer sends back an X/off signal to stop sending data. When enough data is printed and buffer storage becomes free, the printer sends an X/on signal telling the computer to resume sending data.

The “X” stands for “transmitter” so the X/on and X/off are signals to turn a transmitter on or off. The actual signal for X/on is the same bit configuration as the ASCII Ctrl-Q keyboard combination. The X/off signal is the Ctrl-S character.

When you define your modem to your computer’s operating system, you may need to specify the use of flow control with X/on/Xoff or with CTS/RTS (Clear to Send/Ready to Send). When sending binary data, Xon/Xoff may not be recognized because it is character-encoded.

I got a red acknowledgment on TX XBEE X-CTU window, and the acknowledgment is from TX XBEE. IT told me all the data length is “960*3”.

And on the RX XBEE X-CTU, I also saw the same acknowledgment, but blue color.

But now it disappear when I tried again. Who can tell me how I can make it happen again?

Thanks.

PS: I chose hardware in flow control.

The data error is 0. if I transmit data into a packet size 960bytes.

Sending a packet, then have a rest about 5seconds; then sending a packet, then having a rest about 5 seconds; Then sending the next packet, followed by a rest.

So The data on RX XBEE is exactly same to TX data.

stevech:
have you PROVEN that the CTS check works in your hardware/PIC code?

do you have the RTS/CTS based flow control enabled in the XBees?

XON/XOFF - google. It is a software flow control method. There are many such.

What kind of acknowledgment from two xbees talking?

Who can tell me?

It is data length that I sent, right?

What kind of setting I should do if I want to see this acknowledgement in X-CTU?

THANKS.

stevech:
have you PROVEN that the CTS check works in your hardware/PIC code?

do you have the RTS/CTS based flow control enabled in the XBees?

XON/XOFF - google. It is a software flow control method. There are many such.