Serial.print and the Xbee

Hello,

I'm using Xbees in a project I'm working on and I'm hoping to improve it. I've been able to get everything I want functional, although I'm looking to make communication a bit more efficient because it's actually costing me performance. From what I've read about Serial.print, it seems to be parsing everything into single bytes, which then get sent to the Xbee one at a time. So what the Xbee sends, according to here (https://docs.zigbee.org/zigbee-docs/dcn/09-5231.PDF) {page 8}, are a lot of header/foot bytes and a single payload byte. What I'm hoping to do is increase the size to the payload beyond one byte. I was wondering if it's possible to instruct the Serial to send more than a single byte (which would hopefully increase the payload size on the Xbee.) After thinking about it, I believe I can pack all of the information I need into a single 4 byte number. Some simple modular arithmetic on the other side could then unpack this (instead of receiving one byte at a time with a deliminator and corresponding case structure.) Any advice would be well received.

Edit: Damn Smilies

I haven't used Xbee but from what I read you should certainly be able to make multi-byte payloads.

Well, after messing around some, I've realized there is going to be a problem on the receiving end as well. Apparently Serial.read is restricted to reading byte by byte. Is there some way around this?

Huh? Doesn't the Xbee library handle that? Everything on the processor is byte by byte. It's an 8 bit processor. But you can combine them.

There are no Xbee libraries, it's all hardware, you communicate with it both receiving and transmitting using Serial command Arduino libraries.

Hmm. Well this page shows sending a multi-byte payload: