programmable xbee lcd display by character

Hello,

I am working with programmable XBee development board to interface with LCD HD44780 (20x4). I receive a wireless frame on the XBee and display it on the LCD.

It works fine when the length of the is with in 80 characters because I cannot display more than that. For this I want to display the frame character by character so that when the last character is displayed the cursor moves to 0,0 again and then overwrite. This way I could display as much as I can, depending on XBee RAM.

The below code is fine for frame less than or equal to 80 characters. Any tips on how to do the character by character thing for the frame?

CODE :

#include
#include
#include
#include

#define char_lcd_write_str(a) char_lcd_write(a, strlen(a))

static uint8_t test_stage = 0;
static uint8_t test_stage_done = 0;

#if defined(RTC_ENABLE_PERIODIC_TASK)
void rtc_periodic_task(void)
{
test_stage++;
if (test_stage == 8)
test_stage = 0;
test_stage_done = 0;
}
#endif

#ifdef ENABLE_XBEE_HANDLE_RX
int xbee_transparent_rx(const wpan_envelope_t FAR *envelope, void FAR *context)
{
int c,k;
char addrbuf[ADDR64_STRING_LENGTH];
char_lcd_init(CHAR_LCD_CFG);
char_lcd_clear();

addr64_format(addrbuf, &envelope->ieee_address);
sys_watchdog_reset();

char_lcd_write_str(envelope->payload);
delay_ticks(HZ / 10);

return 0;
}
#endif

void main(void)
{
uint8_t i, j;
int data,l;

sys_hw_init();
sys_xbee_init();
sys_app_banner();

char_lcd_init(CHAR_LCD_CFG);

for (;:wink: {
if (!test_stage_done) {
switch (test_stage) {

    case 0:
        char_lcd_goto_xy(0, 0);
        char_lcd_write_str("All working fine");

        break;
    }
    test_stage_done = 1;
}

sys_watchdog_reset();
sys_xbee_tick();

}
}