Display of characters on the LCD display on XBee development board











up vote
0
down vote

favorite












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?



#include <xbee_config.h>
#include <types.h>
#include <string.h>
#include <ctype.h>

#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 (;;) {
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();
}
}









share|improve this question




























    up vote
    0
    down vote

    favorite












    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?



    #include <xbee_config.h>
    #include <types.h>
    #include <string.h>
    #include <ctype.h>

    #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 (;;) {
    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();
    }
    }









    share|improve this question


























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      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?



      #include <xbee_config.h>
      #include <types.h>
      #include <string.h>
      #include <ctype.h>

      #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 (;;) {
      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();
      }
      }









      share|improve this question















      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?



      #include <xbee_config.h>
      #include <types.h>
      #include <string.h>
      #include <ctype.h>

      #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 (;;) {
      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();
      }
      }






      pointers character display xbee lcd






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 19 at 18:12









      user6910411

      32.3k86693




      32.3k86693










      asked Nov 19 at 15:43









      Muhammad Mustafa

      85




      85
























          1 Answer
          1






          active

          oldest

          votes

















          up vote
          0
          down vote













          The wpan_envelope_t structure includes a payload length you can make use of.



          uint16_t length = envelope->length;
          uint16_t offset = 0;
          while (offset < length) {
          uint16_t write = length - offset;
          if (write > 80) write = 80;
          char_lcd_goto_xy(0, 0);
          char_lcd_write(&envelope->payload[offset], write);
          offset += write;
          }


          Note that this will look a bit odd since the end of your string will overlap the previously printed 80 characters. You would potentially want to write out enough spaces after the final char_lcd_write() call to clear out that data (or add a special character to indicate the end of the message).






          share|improve this answer





















            Your Answer






            StackExchange.ifUsing("editor", function () {
            StackExchange.using("externalEditor", function () {
            StackExchange.using("snippets", function () {
            StackExchange.snippets.init();
            });
            });
            }, "code-snippets");

            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "1"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53378143%2fdisplay-of-characters-on-the-lcd-display-on-xbee-development-board%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            0
            down vote













            The wpan_envelope_t structure includes a payload length you can make use of.



            uint16_t length = envelope->length;
            uint16_t offset = 0;
            while (offset < length) {
            uint16_t write = length - offset;
            if (write > 80) write = 80;
            char_lcd_goto_xy(0, 0);
            char_lcd_write(&envelope->payload[offset], write);
            offset += write;
            }


            Note that this will look a bit odd since the end of your string will overlap the previously printed 80 characters. You would potentially want to write out enough spaces after the final char_lcd_write() call to clear out that data (or add a special character to indicate the end of the message).






            share|improve this answer

























              up vote
              0
              down vote













              The wpan_envelope_t structure includes a payload length you can make use of.



              uint16_t length = envelope->length;
              uint16_t offset = 0;
              while (offset < length) {
              uint16_t write = length - offset;
              if (write > 80) write = 80;
              char_lcd_goto_xy(0, 0);
              char_lcd_write(&envelope->payload[offset], write);
              offset += write;
              }


              Note that this will look a bit odd since the end of your string will overlap the previously printed 80 characters. You would potentially want to write out enough spaces after the final char_lcd_write() call to clear out that data (or add a special character to indicate the end of the message).






              share|improve this answer























                up vote
                0
                down vote










                up vote
                0
                down vote









                The wpan_envelope_t structure includes a payload length you can make use of.



                uint16_t length = envelope->length;
                uint16_t offset = 0;
                while (offset < length) {
                uint16_t write = length - offset;
                if (write > 80) write = 80;
                char_lcd_goto_xy(0, 0);
                char_lcd_write(&envelope->payload[offset], write);
                offset += write;
                }


                Note that this will look a bit odd since the end of your string will overlap the previously printed 80 characters. You would potentially want to write out enough spaces after the final char_lcd_write() call to clear out that data (or add a special character to indicate the end of the message).






                share|improve this answer












                The wpan_envelope_t structure includes a payload length you can make use of.



                uint16_t length = envelope->length;
                uint16_t offset = 0;
                while (offset < length) {
                uint16_t write = length - offset;
                if (write > 80) write = 80;
                char_lcd_goto_xy(0, 0);
                char_lcd_write(&envelope->payload[offset], write);
                offset += write;
                }


                Note that this will look a bit odd since the end of your string will overlap the previously printed 80 characters. You would potentially want to write out enough spaces after the final char_lcd_write() call to clear out that data (or add a special character to indicate the end of the message).







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered 2 days ago









                tomlogic

                8,44022155




                8,44022155






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Stack Overflow!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.





                    Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                    Please pay close attention to the following guidance:


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53378143%2fdisplay-of-characters-on-the-lcd-display-on-xbee-development-board%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Create new schema in PostgreSQL using DBeaver

                    Deepest pit of an array with Javascript: test on Codility

                    Costa Masnaga