Any elegant way of text string handling?


Closed Thread
Results 1 to 6 of 6

Hybrid View

  1. #1
    Join Date
    Feb 2013
    Posts
    1,132


    Did you find this post helpful? Yes | No

    Default Re: Any elegant way of text string handling?

    Well I've checked and there are some posts, with ASM code and referring to non-existing pbpcommunity domain.
    So as I can see, the easiest method is to use an external EEPROM or chip's built in one (if there are not much strings to be used) and build system like this - say first 32 bytes (16 words) of eeprom contain entry addresses of separate strings, and to read the stirng we launch a routine, which will start reading eeprom at X address till it reaches value, stored in next string entry address area. Code (for reading single string) should look like this

    Code:
    READ 0, startval ' read entry address of 1st string
    READ 2, nextval 'read entry address of next string
    nextval=nextval-startval 'determine string length
    
    LCDOUT $fe,$2 'set LCD start position to needed area (1st line in this case)
    FOR A=1 to nextval 'start the loop
    READ A,TXT 'read into variable
    LCDOUT $fe,TXT, $14 "Output char and move cursor to next position
    next
    Not the best, but I guess better than with dealing with ASM.

  2. #2
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,139


    Did you find this post helpful? Yes | No

    Default Re: Any elegant way of text string handling?

    Why not use a termination character, say 0 terminated string.

    So you only have to check if you reached the 0 value in the data area that your message is stored.

    This is what Richard suggested. No calculations required.

    Ioannis

  3. #3
    Join Date
    Feb 2013
    Posts
    1,132


    Did you find this post helpful? Yes | No

    Default Re: Any elegant way of text string handling?

    Nice idea, but I have to have all entries for next string marked, so this makes no big difference.....

  4. #4
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,139


    Did you find this post helpful? Yes | No

    Default Re: Any elegant way of text string handling?

    It sure does...

    Think about it.

    Ioannis

Similar Threads

  1. Replies: 3
    Last Post: - 3rd December 2011, 22:48
  2. How to prepare text (lots of text) for HSEROUT ?
    By Byte_Butcher in forum General
    Replies: 0
    Last Post: - 15th February 2010, 22:31
  3. Elegant "in circuit programming"
    By Ted's in forum General
    Replies: 15
    Last Post: - 31st August 2008, 23:42
  4. Interrupt handling on 16F628A
    By Mugelpower in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 21st January 2008, 23:20
  5. interrupt handling faster than if's?
    By mbw123 in forum mel PIC BASIC Pro
    Replies: 13
    Last Post: - 27th October 2006, 01:25

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts