Xbee Transceiver payload

Hi, I have an eventual goal of sending 16 bytes, Do stuff and receive 16 bytes but first I am starting simple. Using Andrew Rapp's library I can send and receive 2 bytes successfully. the problem happens when I send the third and fourth byte, (in this case and the final version it is a mix of bytes( 8 bit) and 10 bit( analog values). But again I am starting simple and doing this byte by byte and I am transmitting on one end only and receiving on the other end only. Here is the code I have so far.
On the Transmitter end:

#include <XBee.h>
XBee xbee = XBee();
uint8_t payload[18];
byte rcv_buffer[18];
Tx16Request tx16 = Tx16Request(0x2000, payload, sizeof(payload));
Rx16Response rx16 = Rx16Response();
TxStatusResponse txStatus = TxStatusResponse();
int x; int y; int rssi;

void setup() {
Serial1.begin(57600);
xbee.begin(57600);  

}
void XBeeXmit(){
  x = 888; y = 999; 
  payload[0] = x >> 8 & 0xff;
  payload[1] = x & 0xff;
  payload[2] = y >> 8 & 0xff;
  payload[3] = y & 0xff; 
 
   xbee.send(tx16);
delay(10);   
  }
void loop() {
  XBeeXmit();
  //XbeeRcv();
}

And on the receiving end:

#include <Adafruit_GFX.h>
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_ILI9341.h>
#include <Adafruit_STMPE610.h>
#include <XBee.h>
 XBee xbee = XBee();
 uint8_t payload[3];
 byte rcv_buffer[4];
 
 // 16-bit addressing: MY address of remote XBee
 Tx16Request tx16 = Tx16Request(0x2001, payload, sizeof(payload));
 Rx16Response rx16 = Rx16Response();
 TxStatusResponse txStatus = TxStatusResponse();
#define STMPE_CS 8
Adafruit_STMPE610 ts = Adafruit_STMPE610(STMPE_CS);
#define TFT_CS 10
#define TFT_DC 9
Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC);int Button1State = 0;
int LastButton1 = 0;
boolean RecordOn = false;
boolean change = false;
int var = 0;
int lastvar = 0;
int store = 0;
int exe = 0;
int xu = 0; int xd = 0;
int yu = 0; int yd = 0;
int spd = 0; int oldSpd = 0; int xpos = 0; int ypos = 0; int rssi = 0;
boolean button7 = false; boolean button8 = false; boolean button9 = false; boolean button10 = false;
boolean button11 = false; boolean button12 = false; boolean button13 = false; boolean button14 = false;
long currentTime = 0; long lastTime = 0; boolean done = false;

void setup(void)
{
  Serial.begin(9600);
  xbee.begin(57600);
  tft.begin();
  if (!ts.begin()) { 
    Serial.println("Unable to start touchscreen.");
  } 
  else { 
    Serial.println("Touchscreen started."); 
  }

  tft.fillScreen(ILI9341_BLUE);
  // origin = left,top landscape (USB left upper)
  tft.setRotation(1);
  
}

void loop()
{
 XbeeRcv();
}

void XbeeRcv()

{ 
  xbee.readPacket();
  if (xbee.getResponse().isAvailable()) {
    // got something
    if (xbee.getResponse().getApiId() == RX_16_RESPONSE) {
      // got a rx packet
      xbee.getResponse().getRx16Response(rx16); 
     for (int i = 0; i < rx16.getDataLength (); i++){
      rcv_buffer[i] = rx16.getData(i);} 
    }
   }
   tft.setTextColor(ILI9341_BLUE);
   tft.setCursor(100,125); tft.println(rssi);
   rssi = rx16.getRssi(); tft.setTextColor(ILI9341_WHITE);
   tft.setCursor(100,125); tft.println(rssi); delay(5);
   tft.setTextColor(ILI9341_BLUE);
   tft.setCursor(100,75); tft.println(xpos);
   tft.setTextColor(ILI9341_BLUE);
   tft.setCursor(100,100); tft.println(ypos);
    //READ VALUE1
   byte ahigh = rx16.getData(0); byte alow = rx16.getData(1);
   xpos = alow + (ahigh *256);
   tft.setTextColor(ILI9341_WHITE);
   tft.setCursor(100,75); tft.println(xpos);
   //READ VALUE2
   byte ahigh2 = rx16.getData(2); byte alow2 = rx16.getData(3);
   ypos = alow + (ahigh *256);
   tft.setTextColor(ILI9341_WHITE);
   tft.setCursor(100,100); tft.println(ypos);   
  }

I've omitted most of the tft touchscreen code to make it easier to read.
What i am returning is a valid RSSI, but x and y position are the same, 888 they change to whatever I want but when I change the x value(on the xmitter both x and y remain the same. when I change y, there is no change and eventually this needs to be 16 bytes back and forth.
What am I missing?

You have a 3 element buffer on the sending end that you stuff 4 values in. Once you write past the end of the array, you can NOT expect ANYTHING to work properly.

I changed it back where I started but that did not make any difference it still does not work.

I changed it back where I started but that did not make any difference it still does not work.

If you have changed, and tested, code after you posted in the first post in this thread, you need to post the code again.

You need to say a lot more than "it still doesn't work".

I read your initial code only far enough to see that glaring error. If there are others, they need to be found and fixed, too. "It doesn't work" is not enough information to help you find the errors.

Ok I am reposting the code from Arduino I still need to understand what is happening. I am using the TFT screen as a debugging device and what I am seeing is xpos=888 and ypos = 888. this changes to whatever I select in the Xmit side on the x value only. It is successfully receiving 2 bytes and reconstructing this number but ignoring the next two bytes. I was changing the buffer elements trying to troubleshoot this and sent the wrong code.

Here is the transmitter side.

#include <XBee.h>
XBee xbee = XBee();
uint8_t payload[18];
byte rcv_buffer[18];
Tx16Request tx16 = Tx16Request(0x2000, payload, sizeof(payload));
Rx16Response rx16 = Rx16Response();
TxStatusResponse txStatus = TxStatusResponse();
int x; int y; int rssi;

void setup() {
Serial1.begin(57600);
xbee.begin(57600);  

}
void XBeeXmit(){
  x = 888; y = 999; 
  payload[0] = x >> 8 & 0xff;
  payload[1] = x & 0xff;
  payload[2] = y >> 8 & 0xff;
  payload[3] = y & 0xff; 
 
   xbee.send(tx16);
delay(10);   
  }
void loop() {
  XBeeXmit();
  //XbeeRcv();
}

And on the receiving end,

 #include <Adafruit_GFX.h>
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_ILI9341.h>
#include <Adafruit_STMPE610.h>
#include <XBee.h>
 XBee xbee = XBee();
 uint8_t payload[3];
 byte rcv_buffer[4];
 
 // 16-bit addressing: MY address of remote XBee
 Tx16Request tx16 = Tx16Request(0x2001, payload, sizeof(payload));
 Rx16Response rx16 = Rx16Response();
 TxStatusResponse txStatus = TxStatusResponse();
#define STMPE_CS 8
Adafruit_STMPE610 ts = Adafruit_STMPE610(STMPE_CS);
#define TFT_CS 10
#define TFT_DC 9
Adafruit_ILI9341 tft = Adafruit_ILI9341(TFT_CS, TFT_DC);int Button1State = 0;
int LastButton1 = 0;
boolean RecordOn = false;
boolean change = false;
int var = 0;
int lastvar = 0;
int store = 0;
int exe = 0;
int xu = 0; int xd = 0;
int yu = 0; int yd = 0;
int spd = 0; int oldSpd = 0; int xpos = 0; int ypos = 0; int rssi = 0;
boolean button7 = false; boolean button8 = false; boolean button9 = false; boolean button10 = false;
boolean button11 = false; boolean button12 = false; boolean button13 = false; boolean button14 = false;
long currentTime = 0; long lastTime = 0; boolean done = false;

void setup(void)
{
  Serial.begin(9600);
  xbee.begin(57600);
  tft.begin();
  if (!ts.begin()) { 
    Serial.println("Unable to start touchscreen.");
  } 
  else { 
    Serial.println("Touchscreen started."); 
  }

  tft.fillScreen(ILI9341_BLUE);
  // origin = left,top landscape (USB left upper)
  tft.setRotation(1);
  
}

void loop()
{
 XbeeRcv();
}

void XbeeRcv()

{ 
  xbee.readPacket();
  if (xbee.getResponse().isAvailable()) {
    // got something
    if (xbee.getResponse().getApiId() == RX_16_RESPONSE) {
      // got a rx packet
      xbee.getResponse().getRx16Response(rx16); 
     for (int i = 0; i < rx16.getDataLength (); i++){
      rcv_buffer[i] = rx16.getData(i);} 
    }
   }
   tft.setTextColor(ILI9341_BLUE);
   tft.setCursor(100,125); tft.println(rssi);
   rssi = rx16.getRssi(); tft.setTextColor(ILI9341_WHITE);
   tft.setCursor(100,125); tft.println(rssi); delay(5);
   tft.setTextColor(ILI9341_BLUE);
   tft.setCursor(100,75); tft.println(xpos);
   tft.setTextColor(ILI9341_BLUE);
   tft.setCursor(100,100); tft.println(ypos);
    //READ VALUE1
   byte ahigh = rx16.getData(0); byte alow = rx16.getData(1);
   xpos = alow + (ahigh *256);
   tft.setTextColor(ILI9341_WHITE);
   tft.setCursor(100,75); tft.println(xpos);
   //READ VALUE2
   byte ahigh2 = rx16.getData(2); byte alow2 = rx16.getData(3);
   ypos = alow + (ahigh *256);
   tft.setTextColor(ILI9341_WHITE);
   tft.setCursor(100,100); tft.println(ypos);   
  }

The goal is to have these two transmit and receive but I have to correct my mistakes first. and right now I am not sure what they are. I suspect that I am not clearing the acknowledgement from the buffer but that is just a theory.