Home/Support/Support Forum/Problem when trying to send 10 messages/second

Problem when trying to send 10 messages/second

0 votes
Hi. I'm new to XBee. I'm using XBee S2C programable as router and XBee S2C PRO as coordinator, all in transparent mode.

My router is programed to send a message each delay_ticks(25)[=0.1s], but I'm receiving 10 messages/second during 7 seconds and in the 8th I receive 11. It seems that I'm accumulating a delay during 7s that allows an extra data to be sent each 8s, without interfering with the following second.

Is there a way to correct this mistake and make sure I always send 10 messages/s, like a more precise delay?

Piece of the code:
for (;;)
now = rtc_get_ms_uptime();

// Check that message has not been sent yet
if (now != before)
before = now;

// Send information packet if XBee has joined the network
if (joined)
env.length = sprintf(tx_buf, "%i", new);
if (new < 9)
new = 0;

// Delay T = 0.1s (1 tick corresponds to 4ms)

// Reset internal counters

Thanks for the input!
asked Jul 2, 2018 in XBee Programmable Development by iagreen New to the Community (0 points)

Please log in or register to answer this question.