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);
xbee_transparent_serial(&env);
if (new < 9)
new++;
else
new = 0;
}
}
// Delay T = 0.1s (1 tick corresponds to 4ms)
delay_ticks(25);
// Reset internal counters
sys_watchdog_reset();
sys_xbee_tick();
}
Thanks for the input!