Problem Receive Data with Xbee

Hi all,

I make a project that used 4 transmit modules with a accelerometer and 1 receiver module that received all the data from the accelerometers. I try first odf course that this is going with one transmitter module.

But there is a problem with the receiver, I use this code at the transmitter:

    payload.id = id;
    
    payload.teller[0] = highByte(teller); 
    payload.teller[1] = lowByte(teller); 

    payload.accxg[0] = highByte(accxg); 
    payload.accxg[1] = lowByte(accxg); /
    
    payload.accyg[0] = highByte(accyg); 
    payload.accyg[1] = lowByte(accyg); 
    
    payload.acczg[0] = highByte(acczg); 
    payload.acczg[1] = lowByte(acczg);

I don’t know how you can receive the data in the right order. I used this code for receive the data, but with the delay’s between the read() functions is it not good. I hope that the right data arrived by the right function and is of course a bad idea .

The receive code:

    payload.id = Serial.read();
    delay(1);  
      
    payload.teller[0] = Serial.read();
    delay(1);
    payload.teller[1] = Serial.read();
    delay(1);
      
    payload.accxg[0] = Serial.read();
    delay(1);
    payload.accxg[1] = Serial.read();
    delay(1);
      
    payload.accyg[0] = Serial.read();
    delay(1);
    payload.accyg[1] = Serial.read();
    delay(1); 
       
    payload.acczg[0] = Serial.read();
    delay(1);
    payload.acczg[1] = Serial.read();
    delay(1);

Does anyone know how to receive it correctly?

Sorry for my english, its not so good…

Thanks for help

Which XBee products are you working with?

Are you using transparent mode or API mode?

Are you sending the frames all at once or with a delay between them?

Thanks for reply,

I work with the XBee S1 on a zigbee sheeld for arduino uno.

The mode is digimesh mode becaus I will work with 4 transmitters. It was maybe an idea that I can first send with my receiver wich transmitter must be send. So I have an synchronisation.

Then I send the frames all at once without delay.

If all of the nodes are in range, there is no need for Mesh. All it will do is reduce your throughput. In this case it would be better to use them in the 802.15.4 mode ad configure them for a classic point to multi-point configuration.

Ok thanks,

I have now a problem with the communication.

My test circuit works very wel. But after a random time then makes my receiver a disconnection. A few seconds later makes he connection again… this reply all the time.

He must have a constant connection off course.

Have you an idea of my problem and know you a solution?

thanks

I am not sure I understand what it is you are saying. What function on the XBee are you using when this “Loss of connection” occurs?

The problem is solved.

I don’t know what I changed but now it works.

Thanks